[refactoring] update ast structure of "Foreach" node

This commit is contained in:
Vadym Slizov
2020-09-14 18:36:55 +03:00
parent 62fc16da97
commit 69bc0af2be
19 changed files with 1202 additions and 1406 deletions

View File

@@ -252,12 +252,6 @@ func (v *Dump) Argument(n *ast.Argument) {
}
}
func (v *Dump) StmtAltForeach(n *ast.StmtAltForeach) {
v.printIndentIfNotSingle(v.indent - 1)
v.print("&ast.StmtAltForeach{\n")
v.printNode(n.GetNode())
}
func (v *Dump) StmtBreak(n *ast.StmtBreak) {
v.printIndentIfNotSingle(v.indent - 1)
v.print("&ast.StmtBreak{\n")

View File

@@ -111,26 +111,6 @@ func (v *FilterParserNodes) StmtReturn(n *ast.StmtReturn) {
}
}
func (v *FilterParserNodes) StmtForeach(n *ast.StmtForeach) {
for {
if nn, ok := n.Expr.(*ast.ParserBrackets); ok {
n.Expr = nn.Child
} else {
break
}
}
}
func (v *FilterParserNodes) StmtAltForeach(n *ast.StmtAltForeach) {
for {
if nn, ok := n.Expr.(*ast.ParserBrackets); ok {
n.Expr = nn.Child
} else {
break
}
}
}
func (v *FilterParserNodes) ExprYield(n *ast.ExprYield) {
for {
if nn, ok := n.Key.(*ast.ParserBrackets); ok {

View File

@@ -213,3 +213,14 @@ func (v *FilterTokens) StmtUnset(n *ast.StmtUnset) {
n.SemiColonTkn = nil
n.SemiColonTkn = nil
}
func (v *FilterTokens) StmtForeach(n *ast.StmtForeach) {
n.ForeachTkn = nil
n.OpenParenthesisTkn = nil
n.AsTkn = nil
n.DoubleArrowTkn = nil
n.CloseParenthesisTkn = nil
n.ColonTkn = nil
n.EndForeachTkn = nil
n.SemiColonTkn = nil
}

View File

@@ -54,10 +54,6 @@ func (v *Null) Argument(_ *ast.Argument) {
// do nothing
}
func (v *Null) StmtAltForeach(_ *ast.StmtAltForeach) {
// do nothing
}
func (v *Null) StmtBreak(_ *ast.StmtBreak) {
// do nothing
}