[refactoring] update ast structure of "Declare" and "ConstList" nodes

This commit is contained in:
Vadym Slizov
2020-09-14 19:25:38 +03:00
parent 69bc0af2be
commit e78f0dc650
11 changed files with 1235 additions and 1271 deletions

View File

@@ -1293,20 +1293,12 @@ func (v *Dump) NameNamePart(n *ast.NameNamePart) {
v.print(fmt.Sprintf("Value: []byte(%q),\n", n.Value))
}
func (v *Dump) ParserAs(n *ast.ParserAs) {
v.printIndentIfNotSingle(v.indent - 1)
v.print("&ast.ParserAs{\n")
v.printNode(n.GetNode())
}
func (v *Dump) ParserNsSeparator(n *ast.ParserNsSeparator) {
v.printIndentIfNotSingle(v.indent - 1)
v.print("&ast.ParserNsSeparator{\n")
v.printNode(n.GetNode())
}
func (v *Dump) ParserBrackets(n *ast.ParserBrackets) {
v.printIndentIfNotSingle(v.indent - 1)
v.print("&ast.ParserBrackets{\n")
v.printNode(n.GetNode())
}
func (v *Dump) ParserSeparatedList(n *ast.ParserSeparatedList) {
// do nothing
}

View File

@@ -70,6 +70,7 @@ func (v *FilterTokens) StmtHaltCompiler(n *ast.StmtHaltCompiler) {
func (v *FilterTokens) StmtConstList(n *ast.StmtConstList) {
n.ConstTkn = nil
n.SeparatorTkns = nil
n.SemiColonTkn = nil
}
@@ -224,3 +225,13 @@ func (v *FilterTokens) StmtForeach(n *ast.StmtForeach) {
n.EndForeachTkn = nil
n.SemiColonTkn = nil
}
func (v *FilterTokens) StmtDeclare(n *ast.StmtDeclare) {
n.DeclareTkn = nil
n.OpenParenthesisTkn = nil
n.SeparatorTkns = nil
n.CloseParenthesisTkn = nil
n.ColonTkn = nil
n.EndDeclareTkn = nil
n.SemiColonTkn = nil
}

View File

@@ -674,14 +674,10 @@ func (v *Null) NameNamePart(_ *ast.NameNamePart) {
// do nothing
}
func (v *Null) ParserAs(_ *ast.ParserAs) {
// do nothing
}
func (v *Null) ParserNsSeparator(_ *ast.ParserNsSeparator) {
// do nothing
}
func (v *Null) ParserBrackets(_ *ast.ParserBrackets) {
// do nothing
}
func (v *Null) ParserSeparatedList(_ *ast.ParserSeparatedList) {
// do nothing
}