diff --git a/internal/php5/parser_test.go b/internal/php5/parser_test.go index a8a9bd5..bceac81 100644 --- a/internal/php5/parser_test.go +++ b/internal/php5/parser_test.go @@ -38822,9 +38822,9 @@ func TestExprNew(t *testing.T) { Expr: &ast.ExprNew{ Position: &position.Position{ StartLine: 1, - EndLine: -1, + EndLine: 1, StartPos: 3, - EndPos: -1, + EndPos: 10, }, NewTkn: &token.Token{ ID: token.T_NEW, @@ -43954,9 +43954,9 @@ func TestExprAssign(t *testing.T) { Expr: &ast.ExprAssignReference{ Position: &position.Position{ StartLine: 4, - EndLine: -1, + EndLine: 4, StartPos: 28, - EndPos: -1, + EndPos: 41, }, Var: &ast.ExprVariable{ Position: &position.Position{ @@ -44032,9 +44032,9 @@ func TestExprAssign(t *testing.T) { Expr: &ast.ExprNew{ Position: &position.Position{ StartLine: 4, - EndLine: -1, + EndLine: 4, StartPos: 34, - EndPos: -1, + EndPos: 41, }, NewTkn: &token.Token{ ID: token.T_NEW, diff --git a/internal/php5/php5.go b/internal/php5/php5.go index b213c53..4c564f9 100644 Binary files a/internal/php5/php5.go and b/internal/php5/php5.go differ diff --git a/internal/php5/php5.y b/internal/php5/php5.y index 41ef5e4..782337f 100644 --- a/internal/php5/php5.y +++ b/internal/php5/php5.y @@ -2751,6 +2751,7 @@ new_expr: } else { $$ = &ast.ExprNew{ Position: yylex.(*Parser).builder.NewTokenNodePosition($1, $2), + NewTkn: $1, Class: $2, } } @@ -2796,7 +2797,7 @@ expr_without_variable: | variable '=' '&' T_NEW class_name_reference ctor_arguments { var _new *ast.ExprNew - if $3 != nil { + if $6 != nil { _new = &ast.ExprNew{ Position: yylex.(*Parser).builder.NewTokenNodePosition($4, $6), NewTkn: $4, @@ -3984,7 +3985,7 @@ backticks_expr: ctor_arguments: /* empty */ { - $$ = &ArgumentList{} + $$ = nil } | function_call_parameter_list { diff --git a/internal/php7/parser_test.go b/internal/php7/parser_test.go index 3df90af..6d09d67 100644 --- a/internal/php7/parser_test.go +++ b/internal/php7/parser_test.go @@ -43581,9 +43581,9 @@ func TestExprNew(t *testing.T) { Expr: &ast.ExprNew{ Position: &position.Position{ StartLine: 1, - EndLine: -1, + EndLine: 1, StartPos: 3, - EndPos: -1, + EndPos: 10, }, NewTkn: &token.Token{ ID: token.T_NEW, @@ -49806,9 +49806,9 @@ func TestExprAssign_Assign(t *testing.T) { Expr: &ast.ExprAssignReference{ Position: &position.Position{ StartLine: 4, - EndLine: -1, + EndLine: 4, StartPos: 28, - EndPos: -1, + EndPos: 41, }, Var: &ast.ExprVariable{ Position: &position.Position{ @@ -49884,9 +49884,9 @@ func TestExprAssign_Assign(t *testing.T) { Expr: &ast.ExprNew{ Position: &position.Position{ StartLine: 4, - EndLine: -1, + EndLine: 4, StartPos: 34, - EndPos: -1, + EndPos: 41, }, NewTkn: &token.Token{ ID: token.T_NEW, diff --git a/internal/php7/php7.go b/internal/php7/php7.go index eeb7595..18eef9d 100644 Binary files a/internal/php7/php7.go and b/internal/php7/php7.go differ diff --git a/internal/php7/php7.y b/internal/php7/php7.y index fceb827..928b3d1 100644 --- a/internal/php7/php7.y +++ b/internal/php7/php7.y @@ -3490,7 +3490,7 @@ backticks_expr: ctor_arguments: /* empty */ { - $$ = &ArgumentList{} + $$ = nil } | argument_list {