Skip to content

Commit a05bde6

Browse files
committed
fixup! Support first-class callables in const-expressions
1 parent cb6aaea commit a05bde6

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Zend/zend_ast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_fcc(void) {
6161
ast->kind = ZEND_AST_CALLABLE_CONVERT;
6262
ast->attr = 0;
6363
ast->lineno = ZEND_MAP_PTR_NEW_OFFSET();
64-
ZEND_MAP_PTR_NEW(ast->fptr);
64+
ZEND_MAP_PTR_INIT(ast->fptr, NULL);
6565

6666
return (zend_ast *) ast;
6767
}

Zend/zend_compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11247,7 +11247,7 @@ static void zend_compile_const_expr_fcc(zend_ast **ast_ptr)
1124711247
if ((*args_ast)->kind != ZEND_AST_CALLABLE_CONVERT) {
1124811248
zend_error_noreturn(E_COMPILE_ERROR, "Constant expression contains invalid operations");
1124911249
}
11250-
*args_ast = zend_ast_create_fcc();
11250+
ZEND_MAP_PTR_NEW(((zend_ast_fcc *)*args_ast)->fptr);
1125111251

1125211252
switch ((*ast_ptr)->kind) {
1125311253
case ZEND_AST_CALL: {

Zend/zend_language_parser.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ return_type:
896896
argument_list:
897897
'(' ')' { $$ = zend_ast_create_list(0, ZEND_AST_ARG_LIST); }
898898
| '(' non_empty_argument_list possible_comma ')' { $$ = $2; }
899-
| '(' T_ELLIPSIS ')' { $$ = zend_ast_create(ZEND_AST_CALLABLE_CONVERT); }
899+
| '(' T_ELLIPSIS ')' { $$ = zend_ast_create_fcc(); }
900900
;
901901

902902
non_empty_argument_list:

0 commit comments

Comments
 (0)