Skip to content

Commit 78492f6

Browse files
author
i582
committed
internal: fixed parsing of anonymous classes
Since now 'ctor_arguments' returns nil, it is necessary to initialize it to avoid panics.
1 parent 61523ab commit 78492f6

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

internal/php7/php7.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/php7/php7.y

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2497,6 +2497,10 @@ non_empty_for_exprs:
24972497
anonymous_class:
24982498
T_CLASS ctor_arguments extends_from implements_list backup_doc_comment '{' class_statement_list '}'
24992499
{
2500+
if $2 == nil {
2501+
$2 = &ArgumentList{}
2502+
}
2503+
25002504
class := &ast.StmtClass{
25012505
Position: yylex.(*Parser).builder.NewTokensPosition($1, $8),
25022506
ClassTkn: $1,

0 commit comments

Comments
 (0)