Implements Twig_NodeVisitorInterface::enterNode().
function enterNode(\Twig_NodeInterface $node, \Twig_Environment $env) {
if ($node instanceof \Twig_Node_Expression_Function) {
$name = $node
->getAttribute('name');
$func = $env
->getFunction($name);
// Optimization: Do not support nested functions.
if ($this->isReference && $func instanceof \Twig_Function_Function) {
$this->isReference = FALSE;
}
if ($func instanceof TwigReferenceFunction) {
// We need to create a TwigReference
$this->isReference = TRUE;
}
}
if ($node instanceof \Twig_Node_Print) {
// Our injected render needs arguments passed by reference -- in case of render array
$this->isReference = TRUE;
}
return $node;
}