internal: fixed parsing of anonymous classes

Since now 'ctor_arguments' returns nil, it is
necessary to initialize it to avoid panics.
This commit is contained in:
i582 2021-02-07 07:52:29 +03:00
parent 61523ab396
commit 78492f6456
2 changed files with 4 additions and 0 deletions

BIN
internal/php7/php7.go generated

Binary file not shown.

View File

@ -2497,6 +2497,10 @@ non_empty_for_exprs:
anonymous_class:
T_CLASS ctor_arguments extends_from implements_list backup_doc_comment '{' class_statement_list '}'
{
if $2 == nil {
$2 = &ArgumentList{}
}
class := &ast.StmtClass{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $8),
ClassTkn: $1,