[refactoring] fix dfs traverser

This commit is contained in:
Vadym Slizov 2020-07-05 18:27:34 +03:00
parent 5cc3b50291
commit b5e29fc9f5

View File

@ -337,6 +337,21 @@ func (t *DFS) Traverse(n ast.Vertex) {
} }
t.visitor.Leave("Modifiers", false) t.visitor.Leave("Modifiers", false)
} }
if nn.ArgumentList != nil {
t.visitor.Enter("ArgumentList", true)
t.Traverse(nn.ArgumentList)
t.visitor.Leave("ArgumentList", true)
}
if nn.Extends != nil {
t.visitor.Enter("Extends", true)
t.Traverse(nn.Extends)
t.visitor.Leave("Extends", true)
}
if nn.Implements != nil {
t.visitor.Enter("Implements", true)
t.Traverse(nn.Implements)
t.visitor.Leave("Implements", true)
}
if nn.Stmts != nil { if nn.Stmts != nil {
t.visitor.Enter("Stmts", false) t.visitor.Enter("Stmts", false)
for _, c := range nn.Stmts { for _, c := range nn.Stmts {
@ -785,6 +800,11 @@ func (t *DFS) Traverse(n ast.Vertex) {
t.Traverse(nn.InterfaceName) t.Traverse(nn.InterfaceName)
t.visitor.Leave("InterfaceName", true) t.visitor.Leave("InterfaceName", true)
} }
if nn.Extends != nil {
t.visitor.Enter("Extends", true)
t.Traverse(nn.Extends)
t.visitor.Leave("Extends", true)
}
if nn.Stmts != nil { if nn.Stmts != nil {
t.visitor.Enter("Stmts", false) t.visitor.Enter("Stmts", false)
for _, c := range nn.Stmts { for _, c := range nn.Stmts {
@ -845,6 +865,12 @@ func (t *DFS) Traverse(n ast.Vertex) {
return return
} }
case *ast.StmtProperty: case *ast.StmtProperty:
if nn == nil {
return
}
if !t.visitor.EnterNode(nn) {
return
}
if nn.Var != nil { if nn.Var != nil {
t.visitor.Enter("Var", true) t.visitor.Enter("Var", true)
t.Traverse(nn.Var) t.Traverse(nn.Var)
@ -950,6 +976,11 @@ func (t *DFS) Traverse(n ast.Vertex) {
t.Traverse(nn.Cond) t.Traverse(nn.Cond)
t.visitor.Leave("Cond", true) t.visitor.Leave("Cond", true)
} }
if nn.CaseList != nil {
t.visitor.Enter("CaseList", true)
t.Traverse(nn.CaseList)
t.visitor.Leave("CaseList", true)
}
case *ast.StmtThrow: case *ast.StmtThrow:
if nn == nil { if nn == nil {
return return
@ -1503,6 +1534,11 @@ func (t *DFS) Traverse(n ast.Vertex) {
t.Traverse(nn.Method) t.Traverse(nn.Method)
t.visitor.Leave("Method", true) t.visitor.Leave("Method", true)
} }
if nn.ArgumentList != nil {
t.visitor.Enter("ArgumentList", true)
t.Traverse(nn.ArgumentList)
t.visitor.Leave("ArgumentList", true)
}
case *ast.ExprNew: case *ast.ExprNew:
if nn == nil { if nn == nil {
return return
@ -1515,6 +1551,11 @@ func (t *DFS) Traverse(n ast.Vertex) {
t.Traverse(nn.Class) t.Traverse(nn.Class)
t.visitor.Leave("Class", true) t.visitor.Leave("Class", true)
} }
if nn.ArgumentList != nil {
t.visitor.Enter("ArgumentList", true)
t.Traverse(nn.ArgumentList)
t.visitor.Leave("ArgumentList", true)
}
case *ast.ExprPostDec: case *ast.ExprPostDec:
if nn == nil { if nn == nil {
return return