[refactoring] update ast structure of "Eval", "Exit", "FunctionCall", "Include" and "IncludeOnce" nodes

This commit is contained in:
Vadym Slizov
2020-12-01 11:58:09 +02:00
parent 2d240e9475
commit 9b122de8bf
9 changed files with 1333 additions and 1335 deletions

View File

@@ -1114,7 +1114,10 @@ func (n *ExprErrorSuppress) Accept(v NodeVisitor) {
// ExprEval node
type ExprEval struct {
Node
Expr Vertex
EvalTkn *token.Token
OpenParenthesisTkn *token.Token
Expr Vertex
CloseParenthesisTkn *token.Token
}
func (n *ExprEval) Accept(v NodeVisitor) {
@@ -1124,8 +1127,10 @@ func (n *ExprEval) Accept(v NodeVisitor) {
// ExprExit node
type ExprExit struct {
Node
Die bool
Expr Vertex
DieTkn *token.Token
OpenParenthesisTkn *token.Token
Expr Vertex
CloseParenthesisTkn *token.Token
}
func (n *ExprExit) Accept(v NodeVisitor) {
@@ -1135,8 +1140,10 @@ func (n *ExprExit) Accept(v NodeVisitor) {
// ExprFunctionCall node
type ExprFunctionCall struct {
Node
Function Vertex
ArgumentList *ArgumentList
Function Vertex
OpenParenthesisTkn *token.Token
Arguments []Vertex
CloseParenthesisTkn *token.Token
}
func (n *ExprFunctionCall) Accept(v NodeVisitor) {
@@ -1146,7 +1153,8 @@ func (n *ExprFunctionCall) Accept(v NodeVisitor) {
// ExprInclude node
type ExprInclude struct {
Node
Expr Vertex
IncludeTkn *token.Token
Expr Vertex
}
func (n *ExprInclude) Accept(v NodeVisitor) {
@@ -1156,7 +1164,8 @@ func (n *ExprInclude) Accept(v NodeVisitor) {
// ExprIncludeOnce node
type ExprIncludeOnce struct {
Node
Expr Vertex
IncludeTkn *token.Token
Expr Vertex
}
func (n *ExprIncludeOnce) Accept(v NodeVisitor) {

View File

@@ -1303,10 +1303,12 @@ func (t *DFS) Traverse(n ast.Vertex) {
t.Traverse(nn.Function)
t.visitor.Leave("Function", 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.ExprInclude:
if nn == nil {

View File

@@ -692,11 +692,6 @@ func (v *Dump) ExprExit(n *ast.ExprExit) {
v.printIndentIfNotSingle(v.indent - 1)
v.print("&ast.ExprExit{\n")
v.printNode(n.GetNode())
if n.Die {
v.printIndent(v.indent)
v.print("Die: true,\n")
}
}
func (v *Dump) ExprFunctionCall(n *ast.ExprFunctionCall) {