@@ -6412,6 +6412,32 @@ static bool can_match_use_jumptable(zend_ast_list *arms) {
64126412 return 1 ;
64136413}
64146414
6415+ static void zend_compile_pipe (znode * result , zend_ast * ast )
6416+ {
6417+ zend_ast * operand_ast = ast -> child [0 ];
6418+ zend_ast * callable_ast = ast -> child [1 ];
6419+
6420+ znode operand_result ;
6421+ zend_compile_expr (& operand_result , operand_ast );
6422+ znode wrapped_operand_result ;
6423+ zend_emit_op_tmp (& wrapped_operand_result , ZEND_QM_ASSIGN , & operand_result , NULL );
6424+
6425+ /* Turn $foo |> bar(...) into bar($foo). */
6426+ if (callable_ast -> kind == ZEND_AST_CALL
6427+ && callable_ast -> child [1 ]-> kind == ZEND_AST_CALLABLE_CONVERT ) {
6428+ callable_ast = callable_ast -> child [0 ];
6429+ }
6430+
6431+ znode callable_result ;
6432+ zend_compile_expr (& callable_result , callable_ast );
6433+
6434+ zend_ast * fcall_ast = zend_ast_create (ZEND_AST_CALL ,
6435+ zend_ast_create_znode (& callable_result ),
6436+ zend_ast_create_list (1 , ZEND_AST_ARG_LIST , zend_ast_create_znode (& wrapped_operand_result )));
6437+
6438+ zend_compile_expr (result , fcall_ast );
6439+ }
6440+
64156441static void zend_compile_match (znode * result , zend_ast * ast )
64166442{
64176443 zend_ast * expr_ast = ast -> child [0 ];
@@ -6598,30 +6624,6 @@ static void zend_compile_match(znode *result, zend_ast *ast)
65986624 efree (jmp_end_opnums );
65996625}
66006626
6601- static void zend_compile_pipe (znode * result , zend_ast * ast )
6602- {
6603- zend_ast * operand_ast = ast -> child [0 ];
6604- zend_ast * callable_ast = ast -> child [1 ];
6605-
6606- znode operand_result ;
6607- zend_compile_expr (& operand_result , operand_ast );
6608-
6609- /* Turn $foo |> bar(...) into bar($foo). */
6610- if (callable_ast -> kind == ZEND_AST_CALL
6611- && callable_ast -> child [1 ]-> kind == ZEND_AST_CALLABLE_CONVERT ) {
6612- callable_ast = callable_ast -> child [0 ];
6613- }
6614-
6615- znode callable_result ;
6616- zend_compile_expr (& callable_result , callable_ast );
6617-
6618- zend_ast * fcall_ast = zend_ast_create (ZEND_AST_CALL ,
6619- zend_ast_create_znode (& callable_result ),
6620- zend_ast_create_list (1 , ZEND_AST_ARG_LIST , zend_ast_create_znode (& operand_result )));
6621-
6622- zend_compile_expr (result , fcall_ast );
6623- }
6624-
66256627static void zend_compile_try (zend_ast * ast ) /* {{{ */
66266628{
66276629 zend_ast * try_ast = ast -> child [0 ];
0 commit comments