[refactoring] update ast structure of "Static", "Global" and "StaticVar" nodes

This commit is contained in:
Vadym Slizov
2020-09-09 22:53:51 +03:00
parent 59ef622082
commit 3f12ada311
10 changed files with 1416 additions and 1324 deletions

View File

@@ -476,7 +476,10 @@ func (n *StmtFunction) Accept(v NodeVisitor) {
// StmtGlobal node
type StmtGlobal struct {
Node
Vars []Vertex
GlobalTkn *token.Token
Vars []Vertex
SeparatorTkns []*token.Token
SemiColonTkn *token.Token
}
func (n *StmtGlobal) Accept(v NodeVisitor) {
@@ -630,7 +633,10 @@ func (n *StmtReturn) Accept(v NodeVisitor) {
// StmtStatic node
type StmtStatic struct {
Node
Vars []Vertex
StaticTkn *token.Token
Vars []Vertex
SeparatorTkns []*token.Token
SemiColonTkn *token.Token
}
func (n *StmtStatic) Accept(v NodeVisitor) {
@@ -640,8 +646,9 @@ func (n *StmtStatic) Accept(v NodeVisitor) {
// StmtStaticVar node
type StmtStaticVar struct {
Node
Var Vertex
Expr Vertex
Var Vertex
EqualTkn *token.Token
Expr Vertex
}
func (n *StmtStaticVar) Accept(v NodeVisitor) {

View File

@@ -178,3 +178,19 @@ func (v *FilterTokens) StmtReturn(n *ast.StmtReturn) {
n.ReturnTkn = nil
n.SemiColonTkn = nil
}
func (v *FilterTokens) StmtGlobal(n *ast.StmtGlobal) {
n.GlobalTkn = nil
n.SeparatorTkns = nil
n.SemiColonTkn = nil
}
func (v *FilterTokens) StmtStatic(n *ast.StmtStatic) {
n.StaticTkn = nil
n.SeparatorTkns = nil
n.SemiColonTkn = nil
}
func (v *FilterTokens) StmtStaticVar(n *ast.StmtStaticVar) {
n.EqualTkn = nil
}