[refactoring] update ast structure of "Constant" nodes
This commit is contained in:
@@ -67,3 +67,18 @@ func (v *FilterTokens) StmtHaltCompiler(n *ast.StmtHaltCompiler) {
|
||||
n.CloseParenthesisTkn = nil
|
||||
n.SemiColonTkn = nil
|
||||
}
|
||||
|
||||
func (v *FilterTokens) StmtConstList(n *ast.StmtConstList) {
|
||||
n.ConstTkn = nil
|
||||
n.SemiColonTkn = nil
|
||||
}
|
||||
|
||||
func (v *FilterTokens) StmtClassConstList(n *ast.StmtClassConstList) {
|
||||
n.ConstTkn = nil
|
||||
n.SemiColonTkn = nil
|
||||
}
|
||||
|
||||
func (v *FilterTokens) StmtConstant(n *ast.StmtConstant) {
|
||||
n.EqualTkn = nil
|
||||
n.CommaTkn = nil
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ func (nsr *NamespaceResolver) StmtPropertyList(n *ast.StmtPropertyList) {
|
||||
|
||||
func (nsr *NamespaceResolver) StmtConstList(n *ast.StmtConstList) {
|
||||
for _, constant := range n.Consts {
|
||||
nsr.AddNamespacedName(constant, string(constant.(*ast.StmtConstant).ConstantName.(*ast.Identifier).Value))
|
||||
nsr.AddNamespacedName(constant, string(constant.(*ast.StmtConstant).Name.(*ast.Identifier).Value))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -594,12 +594,12 @@ func TestResolveConstantsName(t *testing.T) {
|
||||
nameAB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
|
||||
constantB := &ast.StmtConstant{
|
||||
ConstantName: &ast.Identifier{Value: []byte("B")},
|
||||
Expr: &ast.ScalarLnumber{Value: []byte("1")},
|
||||
Name: &ast.Identifier{Value: []byte("B")},
|
||||
Expr: &ast.ScalarLnumber{Value: []byte("1")},
|
||||
}
|
||||
constantC := &ast.StmtConstant{
|
||||
ConstantName: &ast.Identifier{Value: []byte("C")},
|
||||
Expr: &ast.ScalarLnumber{Value: []byte("1")},
|
||||
Name: &ast.Identifier{Value: []byte("C")},
|
||||
Expr: &ast.ScalarLnumber{Value: []byte("1")},
|
||||
}
|
||||
|
||||
stxTree := &ast.StmtStmtList{
|
||||
@@ -638,12 +638,12 @@ func TestResolveNamespaces(t *testing.T) {
|
||||
relativeNameCE := &ast.NameRelative{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("C")}, &ast.NameNamePart{Value: []byte("E")}}}
|
||||
|
||||
constantB := &ast.StmtConstant{
|
||||
ConstantName: &ast.Identifier{Value: []byte("B")},
|
||||
Expr: &ast.ScalarLnumber{Value: []byte("1")},
|
||||
Name: &ast.Identifier{Value: []byte("B")},
|
||||
Expr: &ast.ScalarLnumber{Value: []byte("1")},
|
||||
}
|
||||
constantC := &ast.StmtConstant{
|
||||
ConstantName: &ast.Identifier{Value: []byte("C")},
|
||||
Expr: &ast.ScalarLnumber{Value: []byte("1")},
|
||||
Name: &ast.Identifier{Value: []byte("C")},
|
||||
Expr: &ast.ScalarLnumber{Value: []byte("1")},
|
||||
}
|
||||
|
||||
stxTree := &ast.StmtStmtList{
|
||||
|
||||
Reference in New Issue
Block a user