[refactoring] update ast structure of parameter "Variadic" and "Reference" nodes
This commit is contained in:
parent
43ace92875
commit
ddb9f3b985
BIN
internal/php5/php5.go
generated
BIN
internal/php5/php5.go
generated
Binary file not shown.
@ -2041,15 +2041,23 @@ parameter:
|
||||
yylex.(*Parser).setFreeFloating(variable, token.Start, $4.SkippedTokens)
|
||||
|
||||
if $3 != nil {
|
||||
variable = &ast.Variadic{ast.Node{}, variable}
|
||||
variable.GetNode().Position = position.NewTokensPosition($3, $4)
|
||||
yylex.(*Parser).setFreeFloating(variable, token.Start, $3.SkippedTokens)
|
||||
variable = &ast.Variadic{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokensPosition($3, $4),
|
||||
},
|
||||
VariadicTkn: $3,
|
||||
Var: variable,
|
||||
}
|
||||
}
|
||||
|
||||
if $2 != nil {
|
||||
variable = &ast.Reference{ast.Node{}, variable}
|
||||
variable.GetNode().Position = position.NewTokensPosition($2, $4)
|
||||
yylex.(*Parser).setFreeFloating(variable, token.Start, $2.SkippedTokens)
|
||||
variable = &ast.Reference{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokensPosition($2, $4),
|
||||
},
|
||||
AmpersandTkn: $2,
|
||||
Var: variable,
|
||||
}
|
||||
}
|
||||
|
||||
$$ = &ast.Parameter{ast.Node{}, $1, variable, nil}
|
||||
@ -2081,15 +2089,23 @@ parameter:
|
||||
yylex.(*Parser).setFreeFloating(variable, token.End, $5.SkippedTokens)
|
||||
|
||||
if $3 != nil {
|
||||
variable = &ast.Variadic{ast.Node{}, variable}
|
||||
variable.GetNode().Position = position.NewTokensPosition($3, $4)
|
||||
yylex.(*Parser).setFreeFloating(variable, token.Start, $3.SkippedTokens)
|
||||
variable = &ast.Variadic{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokensPosition($3, $4),
|
||||
},
|
||||
VariadicTkn: $3,
|
||||
Var: variable,
|
||||
}
|
||||
}
|
||||
|
||||
if $2 != nil {
|
||||
variable = &ast.Reference{ast.Node{}, variable}
|
||||
variable.GetNode().Position = position.NewTokensPosition($2, $4)
|
||||
yylex.(*Parser).setFreeFloating(variable, token.Start, $2.SkippedTokens)
|
||||
variable = &ast.Reference{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokensPosition($2, $4),
|
||||
},
|
||||
AmpersandTkn: $2,
|
||||
Var: variable,
|
||||
}
|
||||
}
|
||||
|
||||
$$ = &ast.Parameter{ast.Node{}, $1, variable, $6}
|
||||
|
BIN
internal/php7/php7.go
generated
BIN
internal/php7/php7.go
generated
Binary file not shown.
@ -1865,15 +1865,23 @@ parameter:
|
||||
yylex.(*Parser).setFreeFloating(variable, token.Start, $4.SkippedTokens)
|
||||
|
||||
if $3 != nil {
|
||||
variable = &ast.Variadic{ast.Node{}, variable}
|
||||
variable.GetNode().Position = position.NewTokensPosition($3, $4)
|
||||
yylex.(*Parser).setFreeFloating(variable, token.Start, $3.SkippedTokens)
|
||||
variable = &ast.Variadic{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokensPosition($3, $4),
|
||||
},
|
||||
VariadicTkn: $3,
|
||||
Var: variable,
|
||||
}
|
||||
}
|
||||
|
||||
if $2 != nil {
|
||||
variable = &ast.Reference{ast.Node{}, variable}
|
||||
variable.GetNode().Position = position.NewTokensPosition($2, $4)
|
||||
yylex.(*Parser).setFreeFloating(variable, token.Start, $2.SkippedTokens)
|
||||
variable = &ast.Reference{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokensPosition($2, $4),
|
||||
},
|
||||
AmpersandTkn: $2,
|
||||
Var: variable,
|
||||
}
|
||||
}
|
||||
|
||||
$$ = &ast.Parameter{ast.Node{}, $1, variable, nil}
|
||||
@ -1905,15 +1913,23 @@ parameter:
|
||||
yylex.(*Parser).setFreeFloating(variable, token.End, $5.SkippedTokens)
|
||||
|
||||
if $3 != nil {
|
||||
variable = &ast.Variadic{ast.Node{}, variable}
|
||||
variable.GetNode().Position = position.NewTokensPosition($3, $4)
|
||||
yylex.(*Parser).setFreeFloating(variable, token.Start, $3.SkippedTokens)
|
||||
variable = &ast.Variadic{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokensPosition($3, $4),
|
||||
},
|
||||
VariadicTkn: $3,
|
||||
Var: variable,
|
||||
}
|
||||
}
|
||||
|
||||
if $2 != nil {
|
||||
variable = &ast.Reference{ast.Node{}, variable}
|
||||
variable.GetNode().Position = position.NewTokensPosition($2, $4)
|
||||
yylex.(*Parser).setFreeFloating(variable, token.Start, $2.SkippedTokens)
|
||||
variable = &ast.Reference{
|
||||
Node: ast.Node{
|
||||
Position: position.NewTokensPosition($2, $4),
|
||||
},
|
||||
AmpersandTkn: $2,
|
||||
Var: variable,
|
||||
}
|
||||
}
|
||||
|
||||
$$ = &ast.Parameter{ast.Node{}, $1, variable, $6}
|
||||
|
@ -44,7 +44,8 @@ func (n *Nullable) Accept(v NodeVisitor) {
|
||||
// Reference node
|
||||
type Reference struct {
|
||||
Node
|
||||
Var Vertex
|
||||
AmpersandTkn *token.Token
|
||||
Var Vertex
|
||||
}
|
||||
|
||||
func (n *Reference) Accept(v NodeVisitor) {
|
||||
@ -54,7 +55,8 @@ func (n *Reference) Accept(v NodeVisitor) {
|
||||
// Variadic node
|
||||
type Variadic struct {
|
||||
Node
|
||||
Var Vertex
|
||||
VariadicTkn *token.Token
|
||||
Var Vertex
|
||||
}
|
||||
|
||||
func (n *Variadic) Accept(v NodeVisitor) {
|
||||
|
Loading…
Reference in New Issue
Block a user