[refactoring] update ast structure of "Nullable"

This commit is contained in:
Vadym Slizov 2020-11-20 22:07:58 +02:00
parent bf3ae74d56
commit 43ace92875
No known key found for this signature in database
GPG Key ID: AEA2A9388EF42A4A
4 changed files with 9 additions and 8 deletions

BIN
internal/php5/php5.go generated

Binary file not shown.

BIN
internal/php7/php7.go generated

Binary file not shown.

View File

@ -1948,13 +1948,13 @@ type_expr:
}
| '?' type
{
$$ = &ast.Nullable{ast.Node{}, $2}
// save position
$$.GetNode().Position = position.NewTokenNodePosition($1, $2)
// save comments
yylex.(*Parser).setFreeFloating($$, token.Start, $1.SkippedTokens)
$$ = &ast.Nullable{
Node: ast.Node{
Position: position.NewTokenNodePosition($1, $2),
},
QuestionTkn: $1,
Expr: $2,
}
}
;

View File

@ -33,6 +33,7 @@ func (n *Root) Accept(v NodeVisitor) {
// Nullable node
type Nullable struct {
Node
QuestionTkn *token.Token
Expr Vertex
}