fixed "include" with "ignore missing" when an error loading occurs in the included template (again)

This commit is contained in:
Fabien Potencier
2019-04-06 14:02:52 +02:00
parent 49725a1e8e
commit 8ea68e06e4
9 changed files with 53 additions and 61 deletions
+10 -11
View File
@@ -198,17 +198,6 @@ class ModuleNode extends Node
// parent
if (!$this->hasNode('parent')) {
$compiler->write("\$this->parent = false;\n\n");
} elseif (($parent = $this->getNode('parent')) && $parent instanceof ConstantExpression) {
$compiler
->addDebugInfo($parent)
->write('$this->parent = $this->loadTemplate(')
->subcompile($parent)
->raw(', ')
->repr($this->source->getName())
->raw(', ')
->repr($parent->getTemplateLine())
->raw(");\n")
;
}
$countTraits = \count($this->getNode('traits'));
@@ -331,8 +320,18 @@ class ModuleNode extends Node
if ($this->hasNode('parent')) {
$parent = $this->getNode('parent');
$compiler->addDebugInfo($parent);
if ($parent instanceof ConstantExpression) {
$compiler
->write('$this->parent = $this->loadTemplate(')
->subcompile($parent)
->raw(', ')
->repr($this->source->getName())
->raw(', ')
->repr($parent->getTemplateLine())
->raw(");\n")
;
$compiler->write('$this->parent');
} else {
$compiler->write('$this->getParent($context)');