getSubBlocks() abstract public method

abstract public getSubBlocks ( )
Ejemplo n.º 1
0
 private function dumpOp(Op $op)
 {
     $result = $op->getType();
     foreach ($op->getVariableNames() as $varName) {
         $result .= "\n    {$varName}: ";
         $result .= $this->indent($this->dumpOperand($op->{$varName}));
     }
     foreach ($op->getSubBlocks() as $subBlock) {
         $result .= "\n    {$subBlock}: " . $this->indent($this->dumpBlockRef($op->{$subBlock}));
     }
     return $result;
 }
Ejemplo n.º 2
0
 protected function renderOp(Op $op)
 {
     $result = $op->getType();
     if ($op instanceof Op\CallableOp) {
         $func = $op->getFunc();
         $result .= "<" . $func->name . ">";
     }
     if ($op instanceof Op\Expr\Assertion) {
         $result .= "<" . $this->renderAssertion($op->assertion) . ">";
     }
     foreach ($op->getVariableNames() as $varName) {
         $vars = $op->{$varName};
         if (is_array($vars)) {
             foreach ($vars as $key => $var) {
                 if (!$var) {
                     continue;
                 }
                 $result .= "\n    {$varName}[{$key}]: ";
                 $result .= $this->indent($this->renderOperand($var));
             }
         } elseif ($vars) {
             $result .= "\n    {$varName}: ";
             $result .= $this->indent($this->renderOperand($vars));
         }
     }
     $childBlocks = [];
     foreach ($op->getSubBlocks() as $blockName) {
         $sub = $op->{$blockName};
         if (is_array($sub)) {
             foreach ($sub as $key => $subBlock) {
                 if (!$subBlock) {
                     continue;
                 }
                 $this->enqueueBlock($subBlock);
                 $childBlocks[] = ["block" => $subBlock, "name" => $blockName . "[" . $key . "]"];
             }
         } elseif ($sub) {
             $this->enqueueBlock($sub);
             $childBlocks[] = ["block" => $sub, "name" => $blockName];
         }
     }
     return ["op" => $op, "label" => $result, "childBlocks" => $childBlocks];
 }
Ejemplo n.º 3
0
 protected function renderOp(Op $op)
 {
     $result = $op->getType();
     if ($op instanceof Op\CallableOp) {
         $result .= '<' . $op->name->value . '>';
         foreach ($op->getParams() as $key => $param) {
             $result .= $this->indent("\nParam[{$key}]: " . $this->renderOperand($param->result));
         }
     }
     if ($op instanceof Op\Expr\Assertion) {
         $result .= "<" . $this->renderAssertion($op->assertion) . ">";
     }
     foreach ($op->getVariableNames() as $varName) {
         $vars = $op->{$varName};
         if (!is_array($vars)) {
             $vars = [$vars];
         }
         foreach ($vars as $var) {
             if (!$var) {
                 continue;
             }
             $result .= "\n    {$varName}: ";
             $result .= $this->indent($this->renderOperand($var));
         }
     }
     $childBlocks = [];
     foreach ($op->getSubBlocks() as $blockName) {
         $sub = $op->{$blockName};
         if (is_null($sub)) {
             continue;
         }
         if (!is_array($sub)) {
             $sub = [$sub];
         }
         foreach ($sub as $subBlock) {
             if (!$subBlock) {
                 continue;
             }
             $this->enqueueBlock($subBlock);
             $childBlocks[] = ["block" => $subBlock, "name" => $blockName];
         }
     }
     return ["op" => $op, "label" => $result, "childBlocks" => $childBlocks];
 }