mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-10 17:36:53 +00:00
Fix loop increment on some for loops (fix #562)
The inner loop incrementing code was not added on for loops where the body was not a Twig_Node (but e.g. a Twig_Node_If)
This commit is contained in:
@@ -22,7 +22,7 @@ class Twig_Node_For extends Twig_Node
|
||||
|
||||
public function __construct(Twig_Node_Expression_AssignName $keyTarget, Twig_Node_Expression_AssignName $valueTarget, Twig_Node_Expression $seq, Twig_Node_Expression $ifexpr = null, Twig_NodeInterface $body, Twig_NodeInterface $else = null, $lineno, $tag = null)
|
||||
{
|
||||
$body->setNode('_for_loop', $this->loop = new Twig_Node_ForLoop($lineno, $tag));
|
||||
$body = new Twig_Node(array($body, $this->loop = new Twig_Node_ForLoop($lineno, $tag)));
|
||||
|
||||
if (null !== $ifexpr) {
|
||||
$body = new Twig_Node_If(new Twig_Node(array($ifexpr, $body)), null, $lineno, $tag);
|
||||
|
||||
Reference in New Issue
Block a user