summaryrefslogtreecommitdiff
path: root/Zend/zend_opcode.c
diff options
context:
space:
mode:
authorLevi Morrison <levim@php.net>2015-01-08 23:40:36 +0300
committerLevi Morrison <levim@php.net>2015-01-27 11:49:56 -0700
commitc8576c5a46508ce87f7d2eb2442e6a9283b6a1ce (patch)
tree65a6b0195b60631537af97e7acd726aec127c732 /Zend/zend_opcode.c
parent0290571ccfb3a440599ca009e97f2879bb1d09f0 (diff)
downloadphp-git-c8576c5a46508ce87f7d2eb2442e6a9283b6a1ce.tar.gz
Implement return types
RFC is documented here: https://wiki.php.net/rfc/return_types
Diffstat (limited to 'Zend/zend_opcode.c')
-rw-r--r--Zend/zend_opcode.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index aa2abb2f6b..3fc3b13767 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -367,12 +367,13 @@ ZEND_API void destroy_op_array(zend_op_array *op_array)
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;
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);
@@ -762,6 +763,11 @@ ZEND_API int pass_two(zend_op_array *op_array)
case ZEND_FE_FETCH:
ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op2);
break;
+ case ZEND_VERIFY_RETURN_TYPE:
+ if (op_array->fn_flags & ZEND_ACC_GENERATOR) {
+ MAKE_NOP(opline);
+ }
+ break;
case ZEND_RETURN:
case ZEND_RETURN_BY_REF:
if (op_array->fn_flags & ZEND_ACC_GENERATOR) {