Browse Source

Also look at variables referenced in expressions when determining dependencies between variables

master
Adam Pippin 3 years ago
parent
commit
60f8d2be60
  1. 8
      app/Engine/Cfnpp/Compiler.php

8
app/Engine/Cfnpp/Compiler.php

@ -235,12 +235,18 @@ class Compiler implements \App\Engine\ICompile
$stack = array_merge($stack, $node->getChildren()); $stack = array_merge($stack, $node->getChildren());
} }
// We're really only handling one case here right now
if ($node instanceof NodeFunctionValue && if ($node instanceof NodeFunctionValue &&
$node->getName() == 'var') $node->getName() == 'var')
{ {
$variables[] = $node->getValue(); $variables[] = $node->getValue();
} }
elseif ($node instanceof NodeFunctionValue &&
$node->getName() == 'expr')
{
$parser = new \App\Engine\Cfnpp\Expression\Parser();
$expression = $parser->parse($node->getValue());
$variables = array_merge($variables, $expression->getReferencedVariables());
}
} }
return $variables; return $variables;

Loading…
Cancel
Save