protected function checkLoopUsageCondition(Twig_TokenStream $stream, Twig_NodeInterface $node) {
if ($node instanceof Twig_Node_Expression_GetAttr && $node
->getNode('node') instanceof Twig_Node_Expression_Name && 'loop' == $node
->getNode('node')
->getAttribute('name')) {
throw new Twig_Error_Syntax('The "loop" variable cannot be used in a looping condition', $node
->getLine(), $stream
->getFilename());
}
foreach ($node as $n) {
if (!$n) {
continue;
}
$this
->checkLoopUsageCondition($stream, $n);
}
}