mirror of
https://github.com/twigphp/Twig.git
synced 2026-11-04 01:54:55 +00:00
Use loop() to recurse instead of loop.recurse()
This commit is contained in:
@@ -460,6 +460,15 @@ class ExpressionParser
|
||||
}
|
||||
|
||||
return new GetAttrExpression($args->getNode('0'), $args->getNode('1'), \count($args) > 2 ? $args->getNode('2') : null, Template::ANY_CALL, $line);
|
||||
case 'loop':
|
||||
$args = $this->parseArguments();
|
||||
if (\count($args) < 1) {
|
||||
throw new SyntaxError('The "loop" function takes an iterator as an argument.', $line, $this->parser->getStream()->getSourceContext());
|
||||
}
|
||||
$recurseArgs = new ArrayExpression([], $line);
|
||||
$recurseArgs->addElement($args->getNode('0'));
|
||||
|
||||
return new GetAttrExpression(new NameExpression('loop', $line), new ConstantExpression('__invoke', $line), $recurseArgs, Template::METHOD_CALL, $line);
|
||||
default:
|
||||
if (null !== $alias = $this->parser->getImportedSymbol('function', $name)) {
|
||||
$arguments = new ArrayExpression([], $line);
|
||||
|
||||
Reference in New Issue
Block a user