Skip to content

Commit d34556c

Browse files
committed
Split new_expr to new_(with|without)_parentheses, new_with_parentheses is now a callable_variable
1 parent 1cf8291 commit d34556c

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Zend/zend_language_parser.y

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
255255
%type <ast> extends_from parameter optional_type_without_static argument global_var
256256
%type <ast> static_var class_statement trait_adaptation trait_precedence trait_alias
257257
%type <ast> absolute_trait_method_reference trait_method_reference property echo_expr
258-
%type <ast> new_expr anonymous_class class_name class_name_reference simple_variable
258+
%type <ast> new_with_parentheses new_without_parentheses anonymous_class class_name class_name_reference simple_variable
259259
%type <ast> internal_functions_in_yacc
260260
%type <ast> exit_expr scalar backticks_expr lexical_var function_call member_name property_name
261261
%type <ast> variable_class_name dereferenceable_scalar constant class_constant
@@ -1123,15 +1123,20 @@ anonymous_class:
11231123
}
11241124
;
11251125

1126-
new_expr:
1127-
T_NEW class_name_reference ctor_arguments
1126+
new_with_parentheses:
1127+
T_NEW class_name_reference argument_list
11281128
{ $$ = zend_ast_create(ZEND_AST_NEW, $2, $3); }
11291129
| T_NEW anonymous_class
11301130
{ $$ = $2; }
11311131
| T_NEW attributes anonymous_class
11321132
{ zend_ast_with_attributes($3->child[0], $2); $$ = $3; }
11331133
;
11341134

1135+
new_without_parentheses:
1136+
T_NEW class_name_reference
1137+
{ $$ = zend_ast_create(ZEND_AST_NEW, $2, zend_ast_create_list(0, ZEND_AST_ARG_LIST)); }
1138+
;
1139+
11351140
expr:
11361141
variable
11371142
{ $$ = $1; }
@@ -1225,7 +1230,7 @@ expr:
12251230
$$ = $2;
12261231
if ($$->kind == ZEND_AST_CONDITIONAL) $$->attr = ZEND_PARENTHESIZED_CONDITIONAL;
12271232
}
1228-
| new_expr { $$ = $1; }
1233+
| new_without_parentheses { $$ = $1; }
12291234
| expr '?' expr ':' expr
12301235
{ $$ = zend_ast_create(ZEND_AST_CONDITIONAL, $1, $3, $5); }
12311236
| expr '?' ':' expr
@@ -1443,6 +1448,7 @@ callable_variable:
14431448
| array_object_dereferenceable T_NULLSAFE_OBJECT_OPERATOR property_name argument_list
14441449
{ $$ = zend_ast_create(ZEND_AST_NULLSAFE_METHOD_CALL, $1, $3, $4); }
14451450
| function_call { $$ = $1; }
1451+
| new_with_parentheses { $$ = $1; }
14461452
;
14471453

14481454
variable:

0 commit comments

Comments
 (0)