fixed wrong node type for the for tag
authorFabien Potencier <fabien.potencier@gmail.com>
Fri, 30 Sep 2011 14:40:46 +0000 (16:40 +0200)
committerFabien Potencier <fabien.potencier@gmail.com>
Fri, 30 Sep 2011 15:11:02 +0000 (17:11 +0200)
lib/Twig/TokenParser/For.php

index 5ce8297..39755a4 100644 (file)
@@ -55,10 +55,13 @@ class Twig_TokenParser_For extends Twig_TokenParser
 
         if (count($targets) > 1) {
             $keyTarget = $targets->getNode(0);
+            $keyTarget = new Twig_Node_Expression_AssignName($keyTarget->getAttribute('name'), $keyTarget->getLine());
             $valueTarget = $targets->getNode(1);
+            $valueTarget = new Twig_Node_Expression_AssignName($valueTarget->getAttribute('name'), $valueTarget->getLine());
         } else {
             $keyTarget = new Twig_Node_Expression_AssignName('_key', $lineno);
             $valueTarget = $targets->getNode(0);
+            $valueTarget = new Twig_Node_Expression_AssignName($valueTarget->getAttribute('name'), $valueTarget->getLine());
         }
 
         return new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, $lineno, $this->getTag());