Skip to content

Commit 0b9ec68

Browse files
committed
Dummy
1 parent f5a939a commit 0b9ec68

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

Zend/zend_compile.c

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8138,10 +8138,9 @@ static uint32_t zend_add_dynamic_func_def(zend_op_array *def) {
81388138
return def_offset;
81398139
}
81408140

8141-
static zend_string *zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_ast_decl *decl, bool toplevel) /* {{{ */
8141+
static zend_string *zend_begin_func_decl(zend_op_array *op_array, zend_ast_decl *decl) /* {{{ */
81428142
{
81438143
zend_string *unqualified_name, *name, *lcname;
8144-
zend_op *opline;
81458144

81468145
if (op_array->fn_flags & ZEND_ACC_CLOSURE) {
81478146
zend_string *filename = op_array->filename;
@@ -8208,19 +8207,7 @@ static zend_string *zend_begin_func_decl(znode *result, zend_op_array *op_array,
82088207
}
82098208

82108209
zend_register_seen_symbol(lcname, ZEND_SYMBOL_FUNCTION);
8211-
if (!toplevel) {
8212-
uint32_t func_ref = zend_add_dynamic_func_def(op_array);
8213-
if (op_array->fn_flags & ZEND_ACC_CLOSURE) {
8214-
opline = zend_emit_op_tmp(result, ZEND_DECLARE_LAMBDA_FUNCTION, NULL, NULL);
8215-
opline->op2.num = func_ref;
8216-
} else {
8217-
opline = get_next_op();
8218-
opline->opcode = ZEND_DECLARE_FUNCTION;
8219-
opline->op1_type = IS_CONST;
8220-
LITERAL_STR(opline->op1, zend_string_copy(lcname));
8221-
opline->op2.num = func_ref;
8222-
}
8223-
}
8210+
82248211
return lcname;
82258212
}
82268213
/* }}} */
@@ -8269,10 +8256,29 @@ static zend_op_array *zend_compile_func_decl_ex(
82698256
op_array->scope = ce;
82708257
op_array->function_name = zend_string_copy(decl->name);
82718258
} else if (is_method) {
8259+
ZEND_ASSERT(!toplevel);
82728260
bool has_body = stmt_ast != NULL;
82738261
lcname = zend_begin_method_decl(op_array, decl->name, has_body);
82748262
} else {
8275-
lcname = zend_begin_func_decl(result, op_array, decl, toplevel);
8263+
lcname = zend_begin_func_decl(op_array, decl);
8264+
if (toplevel) {
8265+
op_array->fn_flags |= ZEND_ACC_TOP_LEVEL;
8266+
} else {
8267+
zend_op *opline;
8268+
8269+
uint32_t func_ref = zend_add_dynamic_func_def(op_array);
8270+
if (op_array->fn_flags & ZEND_ACC_CLOSURE) {
8271+
opline = zend_emit_op_tmp(result, ZEND_DECLARE_LAMBDA_FUNCTION, NULL, NULL);
8272+
opline->op2.num = func_ref;
8273+
} else {
8274+
opline = get_next_op();
8275+
opline->opcode = ZEND_DECLARE_FUNCTION;
8276+
opline->op1_type = IS_CONST;
8277+
LITERAL_STR(opline->op1, zend_string_copy(lcname));
8278+
opline->op2.num = func_ref;
8279+
}
8280+
}
8281+
82768282
if (decl->kind == ZEND_AST_ARROW_FUNC) {
82778283
find_implicit_binds(&info, params_ast, stmt_ast);
82788284
compile_implicit_lexical_binds(&info, result, op_array);
@@ -8320,10 +8326,6 @@ static zend_op_array *zend_compile_func_decl_ex(
83208326
CG(active_class_entry) = NULL;
83218327
}
83228328

8323-
if (toplevel) {
8324-
op_array->fn_flags |= ZEND_ACC_TOP_LEVEL;
8325-
}
8326-
83278329
zend_oparray_context_begin(&orig_oparray_context, op_array);
83288330
CG(context).active_property_info = property_info;
83298331
CG(context).active_property_hook_kind = hook_kind;

0 commit comments

Comments
 (0)