diff --git a/app/Cfnpp/Compiler.php b/app/Cfnpp/Compiler.php index 2e680eb..558b7f9 100644 --- a/app/Cfnpp/Compiler.php +++ b/app/Cfnpp/Compiler.php @@ -123,15 +123,6 @@ class Compiler implements \App\Engine\ICompile $this->pass_2($document, $options); return $this->document; - // Process each passed document - /* - foreach ($documents as $next_document) - { - $this->runMergeFunctions($document, $next_document); - $this->merge($document, $next_document); - $this->runFunctions($document); - } - */ } /** @@ -302,14 +293,12 @@ class Compiler implements \App\Engine\ICompile { $variables[] = $node->getValue(); } - /* - // TODO: Reimplement elseif ($node instanceof NodeFunctionValue && $node->getName() == 'expr') { $expression = new \App\Cfnpp\Expression\Expression($node->getValue()); $variables = array_merge($variables, $expression->getReferencedVariables()); - }*/ + } } return $variables; @@ -454,6 +443,12 @@ class Compiler implements \App\Engine\ICompile */ protected function runFunctions(Node $node): void { + $children = $node->getChildren(); + foreach ($children as $child) + { + $this->runFunctions($child); + } + if ($node->isFunctionParent() && isset($this->functions[$node[0]->getName()])) { $function_node = $node[0]; @@ -471,12 +466,6 @@ class Compiler implements \App\Engine\ICompile return; } } - - $children = $node->getChildren(); - foreach ($children as $child) - { - $this->runFunctions($child); - } } /**