array_unshift($this->loopsTargets,
$node->
getNode('key_target'
)->
getAttribute('name'
));
} elseif (!
$this->loops
) { // we are outside a loop
return;
} // when do we need to add the loop variable back?
// the loop variable is referenced for the current loop
elseif ($node instanceof NameExpression && 'loop' ===
$node->
getAttribute('name'
)) { $node->
setAttribute('always_defined', true
);
$this->
addLoopToCurrent();
} // optimize access to loop targets
elseif ($node instanceof NameExpression && \
in_array($node->
getAttribute('name'
),
$this->loopsTargets
)) { $node->
setAttribute('always_defined', true
);
} // block reference
elseif ($node instanceof BlockReferenceNode ||
$node instanceof BlockReferenceExpression
) { $this->
addLoopToCurrent();
}