summaryrefslogtreecommitdiff
path: root/Zend/zend_compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r--Zend/zend_compile.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index b4cb05f616..c534088b58 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -3489,24 +3489,6 @@ int zend_compile_func_cuf(znode *result, zend_ast_list *args, zend_string *lcnam
}
/* }}} */
-static void zend_compile_assert_side_effects(zend_ast *ast) /* {{{ */
-{
- int i;
- int children = zend_ast_is_list(ast) ? zend_ast_get_list(ast)->children : zend_ast_get_num_children(ast);
-
- for (i = 0; i < children; i++) {
- zend_ast *child = (zend_ast_is_list(ast) ? zend_ast_get_list(ast)->child : ast->child)[i];
- if (child) {
- if (child->kind == ZEND_AST_YIELD) {
- zend_mark_function_as_generator();
- } else if (ast->kind >= ZEND_AST_IS_LIST_SHIFT) {
- zend_compile_assert_side_effects(child);
- }
- }
- }
-}
-/* }}} */
-
static int zend_compile_assert(znode *result, zend_ast_list *args, zend_string *name, zend_function *fbc) /* {{{ */
{
if (EG(assertions) >= 0) {
@@ -3549,8 +3531,6 @@ static int zend_compile_assert(znode *result, zend_ast_list *args, zend_string *
}
result->op_type = IS_CONST;
ZVAL_TRUE(&result->u.constant);
-
- zend_compile_assert_side_effects((zend_ast *) args);
}
return SUCCESS;
@@ -5411,6 +5391,10 @@ void zend_compile_func_decl(znode *result, zend_ast *ast) /* {{{ */
}
zend_compile_params(params_ast, return_type_ast);
+ if (CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) {
+ zend_mark_function_as_generator();
+ zend_emit_op(NULL, ZEND_GENERATOR_CREATE, NULL, NULL);
+ }
if (uses_ast) {
zend_compile_closure_uses(uses_ast);
}