com php-src: Merge branch 'typed_returns' of github .com:morrisonlevi/php-src into test: Zend/zend_cl osures.c Zend/zend_compile.c Zend/zend_opcode.c

From: Date: Wed, 28 Jan 2015 03:56:19 +0000
Subject: com php-src: Merge branch 'typed_returns' of github .com:morrisonlevi/php-src into test: Zend/zend_cl osures.c Zend/zend_compile.c Zend/zend_opcode.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-84408@lists.php.net to get a copy of this message
Commit: 638d0cb7531525201e00577d5a77f1da3f84811e Author: Dmitry Stogov <dmitry@zend.com> Wed, 28 Jan 2015 06:56:19 +0300 Parents: 598c935245eca96ce93d1cc112cd8bbd1cf412c9 c8576c5a46508ce87f7d2eb2442e6a9283b6a1ce Branches: master Link: http://git.php.net/?p=php-src..git;a=commitdiff;h=638d0cb7531525201e00577d5a77f1da3f84811e Log: Merge branch 'typed_returns' of github.com:morrisonlevi/php-src into test * 'typed_returns' of github.com:morrisonlevi/php-src: Implement return types Changed paths: MM Zend/zend_closures.c MM Zend/zend_compile.c MM Zend/zend_opcode.c Diff: diff --cc Zend/zend_closures.c index d50b42c,18b5c92..023e741 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@@ -359,7 -359,7 +359,9 @@@ static HashTable *zend_closure_get_debu zend_hash_str_update(closure->debug_info, "this", sizeof("this")-1, &closure->this_ptr); } - if (arg_info) { - if (arg_info && closure->func.common.num_args) { ++ if (arg_info && ++ (closure->func.common.num_args || ++ (closure->func.common.fn_flags & ZEND_ACC_VARIADIC))) { uint32_t i, num_args, required = closure->func.common.required_num_args; array_init(&val); diff --cc Zend/zend_compile.c index e3b15e0,6439988..7476d47 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@@ -3144,6 -3151,9 +3151,12 @@@ void zend_compile_return(zend_ast *ast opline->op1.var = CG(context).fast_call_var; } + if (CG(active_op_array)->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) { + zend_emit_return_type_check(&expr_node, CG(active_op_array)->arg_info - 1); ++ if (expr_node.op_type == IS_CONST) { ++ zval_copy_ctor(&expr_node.u.constant); ++ } + } opline = zend_emit_op(NULL, by_ref ? ZEND_RETURN_BY_REF : ZEND_RETURN, &expr_node, NULL); diff --cc Zend/zend_opcode.c index aa2abb2,3fc3b13..a6d041f --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@@ -367,18 -367,19 +367,26 @@@ ZEND_API void destroy_op_array(zend_op_ zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_dtor_handler, op_array); } if (op_array->arg_info) { - uint32_t num_args = op_array->num_args; + int32_t num_args = op_array->num_args; - int32_t i = op_array->fn_flags & ZEND_ACC_HAS_RETURN_TYPE ? -1 : 0; ++ zend_arg_info *arg_info = op_array->arg_info; ++ int32_t i; ++ if (op_array->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) { ++ arg_info--; ++ num_args++; ++ } if (op_array->fn_flags & ZEND_ACC_VARIADIC) { num_args++; } - for (i = 0; i < num_args; i++) { - for ( ; i < num_args; i++) { -- zend_string_release(op_array->arg_info[i].name); -- if (op_array->arg_info[i].class_name) { -- zend_string_release(op_array->arg_info[i].class_name); ++ for (i = 0 ; i < num_args; i++) { ++ if (arg_info[i].name) { ++ zend_string_release(arg_info[i].name); ++ } ++ if (arg_info[i].class_name) { ++ zend_string_release(arg_info[i].class_name); } } -- efree(op_array->arg_info); ++ efree(arg_info); } }

« previous php.cvs (#84408) next »