fixed typo
authorFabien Potencier <fabien.potencier@gmail.com>
Wed, 22 Dec 2010 10:33:29 +0000 (11:33 +0100)
committerFabien Potencier <fabien.potencier@gmail.com>
Wed, 22 Dec 2010 10:34:23 +0000 (11:34 +0100)
lib/Twig/ExpressionParser.php

index 2a61583..bba2ae3 100644 (file)
@@ -204,6 +204,7 @@ class Twig_ExpressionParser
 
     public function parsePostfixExpression($node)
     {
+        $firstPass = true;
         while (true) {
             $token = $this->parser->getCurrentToken();
             if ($token->getType() == Twig_Token::PUNCTUATION_TYPE) {
@@ -211,14 +212,16 @@ class Twig_ExpressionParser
                     $node = $this->parseSubscriptExpression($node);
                 } elseif ('|' == $token->getValue()) {
                     $node = $this->parseFilterExpression($node);
-                } elseif ($node instanceof Twig_Node_Expression_Name && '(' == $token->getValue()) {
-                    return new Twig_Node_Expression_Function($node, $this->parseArguments(), $node->getLine());
+                } elseif ($firstPass && $node instanceof Twig_Node_Expression_Name && '(' == $token->getValue()) {
+                    $node = new Twig_Node_Expression_Function($node, $this->parseArguments(), $node->getLine());
                 } else {
                     break;
                 }
             } else {
                 break;
             }
+
+            $firstPass = false;
         }
 
         return $node;