fixed using macros in arrow functions

This commit is contained in:
Fabien Potencier
2019-07-03 20:17:43 +02:00
parent f1b1b87912
commit 95352743eb
3 changed files with 13 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
* 2.11.4 (2019-XX-XX)
* n/a
* fixed using macros in arrow functions
* 2.11.3 (2019-06-18)
@@ -44,7 +44,7 @@ class ArrowFunctionExpression extends AbstractExpression
;
}
$compiler
->raw(') use ($context) { ')
->raw(') use ($context, $macros) { ')
;
foreach ($this->getNode('names') as $name) {
$compiler
+11
View File
@@ -22,6 +22,14 @@
{% for k, v in it|map(item => item + 2 ) -%}
{{ k }} = {{ v }}
{% endfor %}
{% macro local_lower(string) %}
{{- string|lower }}
{% endmacro %}
{{ ['A']|map(val => _self.local_lower(val))|join }}
{%- from _self import local_lower as renamed_lower %}
{{ ['A']|map(val => renamed_lower(val))|join }}
--DATA--
return ['it' => new \ArrayIterator([1, 2])]
--EXPECT--
@@ -39,3 +47,6 @@ b = 2*b
0 = 3
1 = 4
a
a