From acd61be98539c2f2a33bf2e0ce8c3987002d318b Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 14 Apr 2015 19:15:40 +0200 Subject: [PATCH] Add "yield from" support to ast pretty printer --- Zend/tests/assert/expect_015.phpt | 2 ++ Zend/zend_ast.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/Zend/tests/assert/expect_015.phpt b/Zend/tests/assert/expect_015.phpt index c2ce1f73fe..80f1bd8aa8 100644 --- a/Zend/tests/assert/expect_015.phpt +++ b/Zend/tests/assert/expect_015.phpt @@ -17,6 +17,7 @@ assert(0 && ($a = function () { @foo(); $y = clone $x; yield 1 => 2; + yield from $x; })); assert(0 && ($a = function &(array &$a, X $b = null) use ($c,&$d) : X { @@ -163,6 +164,7 @@ Warning: assert(): assert(0 && ($a = function () { @foo(); $y = clone $x; yield 1 => 2; + yield from $x; })) failed in %sexpect_015.php on line %d Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null) use($c, &$d): X { diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index d538a2191f..ef6da97178 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -522,6 +522,7 @@ ZEND_API void zend_ast_apply(zend_ast *ast, zend_ast_apply_func fn) { * 60 right print * 70 right yield * 80 right => + * 85 right yield from * 90 right = += -= *= /= .= %= &= |= ^= <<= >>= **= * 100 left ? : * 110 right ?? @@ -1350,6 +1351,8 @@ simple_list: } if (priority > 70) smart_str_appendc(str, ')'); break; + case ZEND_AST_YIELD_FROM: + PREFIX_OP("yield from ", 85, 86); case ZEND_AST_COALESCE: BINARY_OP(" ?? ", 110, 111, 110); case ZEND_AST_STATIC: smart_str_appends(str, "static $"); -- 2.40.0