Merge branch '1.x' into 2.x

* 1.x:
  fixed "include" with "ignore missing" when an error loading occurs in the included template (again)
  fixed "include" with "ignore missing" when an error loading occurs in the included template
This commit is contained in:
Fabien Potencier
2019-04-06 16:41:57 +02:00
14 changed files with 109 additions and 67 deletions
+10 -11
View File
@@ -187,17 +187,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'));
@@ -334,8 +323,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)');