[refactoring] update ast structure of "Do" node
This commit is contained in:
@@ -378,8 +378,13 @@ func (n *StmtDefault) Accept(v NodeVisitor) {
|
||||
// StmtDo node
|
||||
type StmtDo struct {
|
||||
Node
|
||||
Stmt Vertex
|
||||
Cond Vertex
|
||||
DoTkn *token.Token
|
||||
Stmt Vertex
|
||||
WhileTkn *token.Token
|
||||
OpenParenthesisTkn *token.Token
|
||||
Cond Vertex
|
||||
CloseParenthesisTkn *token.Token
|
||||
SemiColonTkn *token.Token
|
||||
}
|
||||
|
||||
func (n *StmtDo) Accept(v NodeVisitor) {
|
||||
|
||||
@@ -13,16 +13,6 @@ func (v *FilterParserNodes) EnterNode(n ast.Vertex) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (v *FilterParserNodes) StmtDo(n *ast.StmtDo) {
|
||||
for {
|
||||
if nn, ok := n.Cond.(*ast.ParserBrackets); ok {
|
||||
n.Cond = nn.Child
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (v *FilterParserNodes) StmtSwitch(n *ast.StmtSwitch) {
|
||||
for {
|
||||
if nn, ok := n.Cond.(*ast.ParserBrackets); ok {
|
||||
|
||||
@@ -122,3 +122,11 @@ func (v *FilterTokens) StmtWhile(n *ast.StmtWhile) {
|
||||
n.EndWhileTkn = nil
|
||||
n.SemiColonTkn = nil
|
||||
}
|
||||
|
||||
func (v *FilterTokens) StmtDo(n *ast.StmtDo) {
|
||||
n.DoTkn = nil
|
||||
n.WhileTkn = nil
|
||||
n.OpenParenthesisTkn = nil
|
||||
n.CloseParenthesisTkn = nil
|
||||
n.SemiColonTkn = nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user