Skip to content

Commit d85662d

Browse files
committed
Improve accuracy of ext_stmt emits during pipe operations
We need to emit the EXT_STMT opcode before we compile the call, so that we attach the line number of where the right hand pipe operator starts. We also do not need to reset the line number anymore. The following code shows where these EXT_STMTs are introduced. ``` <?php /* EXT_STMT */ $myString = "<Hello World>"; $result = /* EXT_STMT */ $myString |> /* EXT_STMT(!0:$myString) */ \htmlentities(...) |> /* EXT_STMT($4) */ \str_split(...) |> /* EXT_STMT($6) */ (fn($x) => array_map(strtoupper(...), $x)) |> /* EXT_STMT($9) */ (fn($x) => join( ', ', $x)); /* EXT_STMT */ echo $result, /* EXT_STMT */ "\n"; ```
1 parent 326c254 commit d85662d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Zend/zend_compile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6534,9 +6534,9 @@ static void zend_compile_pipe(znode *result, zend_ast *ast)
65346534
callable_ast, arg_list_ast);
65356535
}
65366536

6537+
zend_do_extended_stmt(&operand_result);
6538+
65376539
zend_compile_expr(result, fcall_ast);
6538-
CG(zend_lineno) = fcall_ast->lineno;
6539-
zend_do_extended_stmt(result);
65406540
}
65416541

65426542
static void zend_compile_match(znode *result, zend_ast *ast)

0 commit comments

Comments
 (0)