From: nikic <+@ni-po.com> Date: Mon, 20 Dec 2010 17:39:16 +0000 (+0100) Subject: remove $is_multitarget return in parseMultitargetExpression X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=d88a3c805f18c8ea67dbc707cce6cf86ccd42364;p=web%2Fkonrad%2Ftwig.git remove $is_multitarget return in parseMultitargetExpression Furthermore slightly reordered code thus removing redundant expect() --- diff --git a/lib/Twig/ExpressionParser.php b/lib/Twig/ExpressionParser.php index fdcbbe0..2a61583 100644 --- a/lib/Twig/ExpressionParser.php +++ b/lib/Twig/ExpressionParser.php @@ -336,13 +336,8 @@ class Twig_ExpressionParser public function parseMultitargetExpression() { - $lineno = $this->parser->getCurrentToken()->getLine(); $targets = array(); - $is_multitarget = false; while (true) { - if (!empty($targets)) { - $this->parser->getStream()->expect(Twig_Token::PUNCTUATION_TYPE, ',', 'Multiple assignments must be separated by a comma (,)'); - } if ($this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, ')') || $this->parser->getStream()->test(Twig_Token::VAR_END_TYPE) || $this->parser->getStream()->test(Twig_Token::BLOCK_END_TYPE)) @@ -353,9 +348,9 @@ class Twig_ExpressionParser if (!$this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, ',')) { break; } - $is_multitarget = true; + $this->parser->getStream()->next(); } - return array($is_multitarget, new Twig_Node($targets)); + return new Twig_Node($targets); } } diff --git a/lib/Twig/TokenParser/Set.php b/lib/Twig/TokenParser/Set.php index 7bf935e..0cc1960 100644 --- a/lib/Twig/TokenParser/Set.php +++ b/lib/Twig/TokenParser/Set.php @@ -26,7 +26,7 @@ class Twig_TokenParser_Set extends Twig_TokenParser $capture = false; if ($stream->test(Twig_Token::OPERATOR_TYPE, '=')) { $stream->next(); - list(, $values) = $this->parser->getExpressionParser()->parseMultitargetExpression(); + $values = $this->parser->getExpressionParser()->parseMultitargetExpression(); $stream->expect(Twig_Token::BLOCK_END_TYPE);