mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-05 23:17:26 +00:00
fixed using macros in arrow functions
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user