diff --git a/src/Symfony/Bridge/Twig/Node/TransNode.php b/src/Symfony/Bridge/Twig/Node/TransNode.php index edcc7d9298..3a831829ff 100644 --- a/src/Symfony/Bridge/Twig/Node/TransNode.php +++ b/src/Symfony/Bridge/Twig/Node/TransNode.php @@ -55,15 +55,15 @@ class TransNode extends \Twig_Node } if (null !== $vars) { - $compiler->raw('array_merge('); - $this->compileDefaults($compiler, $defaults); $compiler + ->raw('array_merge(') + ->subcompile($defaults) ->raw(', ') ->subcompile($this->getNode('vars')) ->raw(')') ; } else { - $this->compileDefaults($compiler, $defaults); + $compiler->subcompile($defaults); } $compiler @@ -79,20 +79,6 @@ class TransNode extends \Twig_Node $compiler->raw(");\n"); } - protected function compileDefaults(\Twig_Compiler $compiler, \Twig_Node_Expression_Array $defaults) - { - $compiler->raw('array('); - foreach ($defaults as $name => $default) { - $compiler - ->repr($name) - ->raw(' => ') - ->subcompile($default) - ->raw(', ') - ; - } - $compiler->raw(')'); - } - protected function compileString(\Twig_NodeInterface $body, \Twig_Node_Expression_Array $vars) { if ($body instanceof \Twig_Node_Expression_Constant) {