[refactoring] update ast structure of "ExprMethodCall" and "ExprPropertyFetch" nodes
This commit is contained in:
@@ -1215,9 +1215,12 @@ func (n *ExprList) Accept(v NodeVisitor) {
|
||||
// ExprMethodCall node
|
||||
type ExprMethodCall struct {
|
||||
Node
|
||||
Var Vertex
|
||||
Method Vertex
|
||||
ArgumentList *ArgumentList
|
||||
Var Vertex
|
||||
ObjectOperatorTkn *token.Token
|
||||
Method Vertex
|
||||
OpenParenthesisTkn *token.Token
|
||||
Arguments []Vertex
|
||||
CloseParenthesisTkn *token.Token
|
||||
}
|
||||
|
||||
func (n *ExprMethodCall) Accept(v NodeVisitor) {
|
||||
@@ -1288,8 +1291,9 @@ func (n *ExprPrint) Accept(v NodeVisitor) {
|
||||
// ExprPropertyFetch node
|
||||
type ExprPropertyFetch struct {
|
||||
Node
|
||||
Var Vertex
|
||||
Property Vertex
|
||||
Var Vertex
|
||||
ObjectOperatorTkn *token.Token
|
||||
Property Vertex
|
||||
}
|
||||
|
||||
func (n *ExprPropertyFetch) Accept(v NodeVisitor) {
|
||||
|
||||
@@ -1396,10 +1396,12 @@ func (t *DFS) Traverse(n ast.Vertex) {
|
||||
t.Traverse(nn.Method)
|
||||
t.visitor.Leave("Method", true)
|
||||
}
|
||||
if nn.ArgumentList != nil {
|
||||
t.visitor.Enter("ArgumentList", true)
|
||||
t.Traverse(nn.ArgumentList)
|
||||
t.visitor.Leave("ArgumentList", true)
|
||||
if nn.Arguments != nil {
|
||||
t.visitor.Enter("Arguments", false)
|
||||
for _, c := range nn.Arguments {
|
||||
t.Traverse(c)
|
||||
}
|
||||
t.visitor.Leave("Arguments", false)
|
||||
}
|
||||
case *ast.ExprNew:
|
||||
if nn == nil {
|
||||
|
||||
@@ -1133,7 +1133,7 @@ func (p *PrettyPrinter) printExprMethodCall(n ast.Vertex) {
|
||||
io.WriteString(p.w, "->")
|
||||
p.Print(nn.Method)
|
||||
io.WriteString(p.w, "(")
|
||||
p.joinPrint(", ", nn.ArgumentList.Arguments)
|
||||
p.joinPrint(", ", nn.Arguments)
|
||||
io.WriteString(p.w, ")")
|
||||
}
|
||||
|
||||
|
||||
@@ -1695,9 +1695,9 @@ func (p *Printer) printExprMethodCall(n ast.Vertex) {
|
||||
p.write([]byte("->"))
|
||||
p.Print(nn.Method)
|
||||
|
||||
p.printFreeFloatingOrDefault(nn.ArgumentList, token.Start, "(")
|
||||
p.joinPrint(",", nn.ArgumentList.Arguments)
|
||||
p.printFreeFloatingOrDefault(nn.ArgumentList, token.End, ")")
|
||||
p.printToken(nn.OpenParenthesisTkn, "(")
|
||||
p.joinPrint(",", nn.Arguments)
|
||||
p.printToken(nn.CloseParenthesisTkn, ")")
|
||||
|
||||
p.printFreeFloating(nn, token.End)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user