Merge branch '2.x' into 3.x

* 2.x:
  macros imported "globally" in a template are now available in macros without re-importing them
  added more tests
  added some tests
This commit is contained in:
Fabien Potencier
2019-05-17 14:16:15 +02:00
24 changed files with 205 additions and 41 deletions
+3 -1
View File
@@ -160,7 +160,8 @@ final class ModuleNode extends Node
->raw(" extends Template\n")
->write("{\n")
->indent()
->write("private \$source;\n\n")
->write("private \$source;\n")
->write("private \$macros = [];\n\n")
;
}
@@ -304,6 +305,7 @@ final class ModuleNode extends Node
$compiler
->write("protected function doDisplay(array \$context, array \$blocks = [])\n", "{\n")
->indent()
->write("\$macros = \$this->macros;\n")
->subcompile($this->getNode('display_start'))
->subcompile($this->getNode('body'))
;