[refactoring] update ast structure of "Unset" node
This commit is contained in:
@@ -783,7 +783,12 @@ func (n *StmtTry) Accept(v NodeVisitor) {
|
||||
// StmtUnset node
|
||||
type StmtUnset struct {
|
||||
Node
|
||||
Vars []Vertex
|
||||
UnsetTkn *token.Token
|
||||
OpenParenthesisTkn *token.Token
|
||||
Vars []Vertex
|
||||
SeparatorTkns []*token.Token
|
||||
CloseParenthesisTkn *token.Token
|
||||
SemiColonTkn *token.Token
|
||||
}
|
||||
|
||||
func (n *StmtUnset) Accept(v NodeVisitor) {
|
||||
|
||||
@@ -204,3 +204,12 @@ func (v *FilterTokens) StmtEcho(n *ast.StmtEcho) {
|
||||
func (v *FilterTokens) StmtInlineHtml(n *ast.StmtInlineHtml) {
|
||||
n.InlineHtmlTkn = nil
|
||||
}
|
||||
|
||||
func (v *FilterTokens) StmtUnset(n *ast.StmtUnset) {
|
||||
n.UnsetTkn = nil
|
||||
n.OpenParenthesisTkn = nil
|
||||
n.SeparatorTkns = nil
|
||||
n.CloseParenthesisTkn = nil
|
||||
n.SemiColonTkn = nil
|
||||
n.SemiColonTkn = nil
|
||||
}
|
||||
|
||||
@@ -2905,24 +2905,12 @@ func (p *Printer) printStmtTry(n ast.Vertex) {
|
||||
p.printFreeFloating(nn, token.End)
|
||||
}
|
||||
|
||||
func (p *Printer) printStmtUnset(n ast.Vertex) {
|
||||
nn := n.(*ast.StmtUnset)
|
||||
p.printFreeFloating(nn, token.Start)
|
||||
|
||||
p.write([]byte("unset"))
|
||||
p.printFreeFloating(nn, token.Unset)
|
||||
p.write([]byte("("))
|
||||
p.joinPrint(",", nn.Vars)
|
||||
p.printFreeFloating(nn, token.VarList)
|
||||
p.write([]byte(")"))
|
||||
p.printFreeFloating(nn, token.CloseParenthesisToken)
|
||||
|
||||
p.printFreeFloating(nn, token.SemiColon)
|
||||
if n.GetNode().Tokens.IsEmpty() {
|
||||
p.write([]byte(";"))
|
||||
}
|
||||
|
||||
p.printFreeFloating(nn, token.End)
|
||||
func (p *Printer) printStmtUnset(n *ast.StmtUnset) {
|
||||
p.printToken(n.UnsetTkn, "unset")
|
||||
p.printToken(n.OpenParenthesisTkn, "(")
|
||||
p.printSeparatedList(n.Vars, n.SeparatorTkns, ",")
|
||||
p.printToken(n.CloseParenthesisTkn, ")")
|
||||
p.printToken(n.SemiColonTkn, ";")
|
||||
}
|
||||
|
||||
func (p *Printer) printStmtUse(n *ast.StmtUse) {
|
||||
|
||||
Reference in New Issue
Block a user