protected function Twig_NodeVisitor_Optimizer::optimizeVariables in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php \Twig_NodeVisitor_Optimizer::optimizeVariables()
1 call to Twig_NodeVisitor_Optimizer::optimizeVariables()
- Twig_NodeVisitor_Optimizer::doEnterNode in vendor/
twig/ twig/ lib/ Twig/ NodeVisitor/ Optimizer.php - Called before child nodes are visited.
File
- vendor/
twig/ twig/ lib/ Twig/ NodeVisitor/ Optimizer.php, line 112
Class
- Twig_NodeVisitor_Optimizer
- Twig_NodeVisitor_Optimizer tries to optimizes the AST.
Code
protected function optimizeVariables(Twig_NodeInterface $node, Twig_Environment $env) {
if ('Twig_Node_Expression_Name' === get_class($node) && $node
->isSimple()) {
$this->prependedNodes[0][] = $node
->getAttribute('name');
return new Twig_Node_Expression_TempName($node
->getAttribute('name'), $node
->getLine());
}
return $node;
}