[refactoring] update ast structure of "array" and "list" nodes

This commit is contained in:
Vadym Slizov
2020-11-30 23:42:56 +02:00
parent 43f6fab862
commit 47b974a3a4
11 changed files with 1547 additions and 1475 deletions

View File

@@ -274,10 +274,6 @@ func (p *PrettyPrinter) printNode(n ast.Vertex) {
p.printExprRequireOnce(n)
case *ast.ExprShellExec:
p.printExprShellExec(n)
case *ast.ExprShortArray:
p.printExprShortArray(n)
case *ast.ExprShortList:
p.printExprShortList(n)
case *ast.ExprStaticCall:
p.printExprStaticCall(n)
case *ast.ExprStaticPropertyFetch:
@@ -1240,22 +1236,6 @@ func (p *PrettyPrinter) printExprShellExec(n ast.Vertex) {
io.WriteString(p.w, "`")
}
func (p *PrettyPrinter) printExprShortArray(n ast.Vertex) {
nn := n.(*ast.ExprShortArray)
io.WriteString(p.w, "[")
p.joinPrint(", ", nn.Items)
io.WriteString(p.w, "]")
}
func (p *PrettyPrinter) printExprShortList(n ast.Vertex) {
nn := n.(*ast.ExprShortList)
io.WriteString(p.w, "[")
p.joinPrint(", ", nn.Items)
io.WriteString(p.w, "]")
}
func (p *PrettyPrinter) printExprStaticCall(n ast.Vertex) {
nn := n.(*ast.ExprStaticCall)

View File

@@ -363,10 +363,6 @@ func (p *Printer) printNode(n ast.Vertex) {
p.printExprRequireOnce(n)
case *ast.ExprShellExec:
p.printExprShellExec(n)
case *ast.ExprShortArray:
p.printExprShortArray(n)
case *ast.ExprShortList:
p.printExprShortList(n)
case *ast.ExprStaticCall:
p.printExprStaticCall(n)
case *ast.ExprStaticPropertyFetch:
@@ -1837,30 +1833,6 @@ func (p *Printer) printExprShellExec(n ast.Vertex) {
p.printFreeFloating(nn, token.End)
}
func (p *Printer) printExprShortArray(n ast.Vertex) {
nn := n.(*ast.ExprShortArray)
p.printFreeFloating(nn, token.Start)
p.write([]byte("["))
p.joinPrint(",", nn.Items)
p.printFreeFloating(nn, token.ArrayPairList)
p.write([]byte("]"))
p.printFreeFloating(nn, token.End)
}
func (p *Printer) printExprShortList(n ast.Vertex) {
nn := n.(*ast.ExprShortList)
p.printFreeFloating(nn, token.Start)
p.write([]byte("["))
p.joinPrint(",", nn.Items)
p.printFreeFloating(nn, token.ArrayPairList)
p.write([]byte("]"))
p.printFreeFloating(nn, token.End)
}
func (p *Printer) printExprStaticCall(n ast.Vertex) {
nn := n.(*ast.ExprStaticCall)
p.printFreeFloating(nn, token.Start)