bug #1763 Remove broken code (stof)

This PR was merged into the 1.x branch.

Discussion
----------

Remove broken code

https://github.com/twigphp/Twig/commit/651613c32c315bbeb330b2a6354b34c288e9ea0a#diff-841d1051670799376e88c87114d2caf0 broke the code of ``Twig_Node_Module::compileLoadTemplate`` when passing a non-constant node (it triggers a fatal error)
Trait templates can only be constant expression nodes, so fixing the broken is not actually needed and it can be removed.
Given it is a protected method, I haven't changed the signature to typehint the node as a Twig_Node_Expression_Constant

Commits
-------

e6ae0d0 Remove broken code
This commit is contained in:
Fabien Potencier
2015-08-15 21:53:40 +02:00
+1 -16
View File
@@ -402,22 +402,7 @@ class Twig_Node_Module extends Twig_Node
->raw(");\n")
;
} else {
$compiler
->write(sprintf('%s = ', $var))
->subcompile($node)
->raw(";\n")
->write(sprintf('if (!%s', $var))
->raw(" instanceof Twig_Template) {\n")
->indent()
->write(sprintf('%s = $this->loadTemplate(%s')
->raw(', ')
->repr($compiler->getFilename())
->raw(', ')
->repr($node->getLine())
->raw(");\n", $var, $var))
->outdent()
->write("}\n")
;
throw new LogicException('Trait templates can only be constant nodes');
}
}
}