]> granicus.if.org Git - php/commitdiff
Add "yield from" support to ast pretty printer
authorNikita Popov <nikic@php.net>
Tue, 14 Apr 2015 17:15:40 +0000 (19:15 +0200)
committerNikita Popov <nikic@php.net>
Tue, 14 Apr 2015 17:15:40 +0000 (19:15 +0200)
Zend/tests/assert/expect_015.phpt
Zend/zend_ast.c

index c2ce1f73fec96d663c7140e503ba792a5ff3f19c..80f1bd8aa812a4058812d445111818513a93ade3 100644 (file)
@@ -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 {
index d538a2191f22a20d783fc7f3b17a865c092efd98..ef6da97178b476ce2dce2c1c313b5df016449bdf 100644 (file)
@@ -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 $");