refactoring: fix naming
This commit is contained in:
@@ -57,9 +57,9 @@ type Visitor interface {
|
||||
StmtTraitUsePrecedence(n *StmtTraitUsePrecedence)
|
||||
StmtTry(n *StmtTry)
|
||||
StmtUnset(n *StmtUnset)
|
||||
StmtUse(n *StmtUse)
|
||||
StmtGroupUse(n *StmtGroupUse)
|
||||
StmtUseDeclaration(n *StmtUseDeclaration)
|
||||
StmtUse(n *StmtUseList)
|
||||
StmtGroupUse(n *StmtGroupUseList)
|
||||
StmtUseDeclaration(n *StmtUse)
|
||||
StmtWhile(n *StmtWhile)
|
||||
|
||||
ExprArray(n *ExprArray)
|
||||
@@ -166,8 +166,8 @@ type Visitor interface {
|
||||
ScalarMagicConstant(n *ScalarMagicConstant)
|
||||
ScalarString(n *ScalarString)
|
||||
|
||||
NameName(n *NameName)
|
||||
NameName(n *Name)
|
||||
NameFullyQualified(n *NameFullyQualified)
|
||||
NameRelative(n *NameRelative)
|
||||
NameNamePart(n *NameNamePart)
|
||||
NameNamePart(n *NamePart)
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ func (n *ScalarEncapsedStringPart) GetPosition() *position.Position {
|
||||
type ScalarEncapsedStringVar struct {
|
||||
Position *position.Position
|
||||
DollarOpenCurlyBracketTkn *token.Token
|
||||
VarName Vertex
|
||||
Name Vertex
|
||||
OpenSquareBracketTkn *token.Token
|
||||
Dim Vertex
|
||||
CloseSquareBracketTkn *token.Token
|
||||
@@ -288,9 +288,9 @@ type StmtClass struct {
|
||||
Position *position.Position
|
||||
Modifiers []Vertex
|
||||
ClassTkn *token.Token
|
||||
ClassName Vertex
|
||||
Name Vertex
|
||||
OpenParenthesisTkn *token.Token
|
||||
Arguments []Vertex
|
||||
Args []Vertex
|
||||
SeparatorTkns []*token.Token
|
||||
CloseParenthesisTkn *token.Token
|
||||
ExtendsTkn *token.Token
|
||||
@@ -335,7 +335,7 @@ type StmtClassMethod struct {
|
||||
Modifiers []Vertex
|
||||
FunctionTkn *token.Token
|
||||
AmpersandTkn *token.Token
|
||||
MethodName Vertex
|
||||
Name Vertex
|
||||
OpenParenthesisTkn *token.Token
|
||||
Params []Vertex
|
||||
SeparatorTkns []*token.Token
|
||||
@@ -603,7 +603,7 @@ type StmtFunction struct {
|
||||
Position *position.Position
|
||||
FunctionTkn *token.Token
|
||||
AmpersandTkn *token.Token
|
||||
FunctionName Vertex
|
||||
Name Vertex
|
||||
OpenParenthesisTkn *token.Token
|
||||
Params []Vertex
|
||||
SeparatorTkns []*token.Token
|
||||
@@ -715,7 +715,7 @@ func (n *StmtInlineHtml) GetPosition() *position.Position {
|
||||
type StmtInterface struct {
|
||||
Position *position.Position
|
||||
InterfaceTkn *token.Token
|
||||
InterfaceName Vertex
|
||||
Name Vertex
|
||||
ExtendsTkn *token.Token
|
||||
Extends []Vertex
|
||||
ExtendsSeparatorTkns []*token.Token
|
||||
@@ -734,9 +734,9 @@ func (n *StmtInterface) GetPosition() *position.Position {
|
||||
|
||||
// StmtLabel node
|
||||
type StmtLabel struct {
|
||||
Position *position.Position
|
||||
LabelName Vertex
|
||||
ColonTkn *token.Token
|
||||
Position *position.Position
|
||||
Name Vertex
|
||||
ColonTkn *token.Token
|
||||
}
|
||||
|
||||
func (n *StmtLabel) Accept(v Visitor) {
|
||||
@@ -801,7 +801,7 @@ type StmtPropertyList struct {
|
||||
Position *position.Position
|
||||
Modifiers []Vertex
|
||||
Type Vertex
|
||||
Properties []Vertex
|
||||
Props []Vertex
|
||||
SeparatorTkns []*token.Token
|
||||
SemiColonTkn *token.Token
|
||||
}
|
||||
@@ -889,7 +889,7 @@ type StmtSwitch struct {
|
||||
ColonTkn *token.Token
|
||||
OpenCurlyBracketTkn *token.Token
|
||||
CaseSeparatorTkn *token.Token
|
||||
CaseList []Vertex
|
||||
Cases []Vertex
|
||||
CloseCurlyBracketTkn *token.Token
|
||||
EndSwitchTkn *token.Token
|
||||
SemiColonTkn *token.Token
|
||||
@@ -923,7 +923,7 @@ func (n *StmtThrow) GetPosition() *position.Position {
|
||||
type StmtTrait struct {
|
||||
Position *position.Position
|
||||
TraitTkn *token.Token
|
||||
TraitName Vertex
|
||||
Name Vertex
|
||||
OpenCurlyBracketTkn *token.Token
|
||||
Stmts []Vertex
|
||||
CloseCurlyBracketTkn *token.Token
|
||||
@@ -1035,26 +1035,26 @@ func (n *StmtUnset) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
// StmtUse node
|
||||
type StmtUse struct {
|
||||
Position *position.Position
|
||||
UseTkn *token.Token
|
||||
Type Vertex
|
||||
UseDeclarations []Vertex
|
||||
SeparatorTkns []*token.Token
|
||||
SemiColonTkn *token.Token
|
||||
// StmtUseList node
|
||||
type StmtUseList struct {
|
||||
Position *position.Position
|
||||
UseTkn *token.Token
|
||||
Type Vertex
|
||||
Uses []Vertex
|
||||
SeparatorTkns []*token.Token
|
||||
SemiColonTkn *token.Token
|
||||
}
|
||||
|
||||
func (n *StmtUse) Accept(v Visitor) {
|
||||
func (n *StmtUseList) Accept(v Visitor) {
|
||||
v.StmtUse(n)
|
||||
}
|
||||
|
||||
func (n *StmtUse) GetPosition() *position.Position {
|
||||
func (n *StmtUseList) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
// StmtGroupUse node
|
||||
type StmtGroupUse struct {
|
||||
// StmtGroupUseList node
|
||||
type StmtGroupUseList struct {
|
||||
Position *position.Position
|
||||
UseTkn *token.Token
|
||||
Type Vertex
|
||||
@@ -1062,22 +1062,22 @@ type StmtGroupUse struct {
|
||||
Prefix Vertex
|
||||
NsSeparatorTkn *token.Token
|
||||
OpenCurlyBracketTkn *token.Token
|
||||
UseDeclarations []Vertex
|
||||
Uses []Vertex
|
||||
SeparatorTkns []*token.Token
|
||||
CloseCurlyBracketTkn *token.Token
|
||||
SemiColonTkn *token.Token
|
||||
}
|
||||
|
||||
func (n *StmtGroupUse) Accept(v Visitor) {
|
||||
func (n *StmtGroupUseList) Accept(v Visitor) {
|
||||
v.StmtGroupUse(n)
|
||||
}
|
||||
|
||||
func (n *StmtGroupUse) GetPosition() *position.Position {
|
||||
func (n *StmtGroupUseList) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
// StmtUseDeclaration node
|
||||
type StmtUseDeclaration struct {
|
||||
// StmtUse node
|
||||
type StmtUse struct {
|
||||
Position *position.Position
|
||||
Type Vertex
|
||||
NsSeparatorTkn *token.Token
|
||||
@@ -1086,11 +1086,11 @@ type StmtUseDeclaration struct {
|
||||
Alias Vertex
|
||||
}
|
||||
|
||||
func (n *StmtUseDeclaration) Accept(v Visitor) {
|
||||
func (n *StmtUse) Accept(v Visitor) {
|
||||
v.StmtUseDeclaration(n)
|
||||
}
|
||||
|
||||
func (n *StmtUseDeclaration) GetPosition() *position.Position {
|
||||
func (n *StmtUse) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
@@ -1242,7 +1242,7 @@ type ExprClassConstFetch struct {
|
||||
Position *position.Position
|
||||
Class Vertex
|
||||
DoubleColonTkn *token.Token
|
||||
ConstantName Vertex
|
||||
Const Vertex
|
||||
}
|
||||
|
||||
func (n *ExprClassConstFetch) Accept(v Visitor) {
|
||||
@@ -1280,7 +1280,7 @@ type ExprClosure struct {
|
||||
CloseParenthesisTkn *token.Token
|
||||
UseTkn *token.Token
|
||||
UseOpenParenthesisTkn *token.Token
|
||||
Use []Vertex
|
||||
Uses []Vertex
|
||||
UseSeparatorTkns []*token.Token
|
||||
UseCloseParenthesisTkn *token.Token
|
||||
ColonTkn *token.Token
|
||||
@@ -1398,7 +1398,7 @@ type ExprFunctionCall struct {
|
||||
Position *position.Position
|
||||
Function Vertex
|
||||
OpenParenthesisTkn *token.Token
|
||||
Arguments []Vertex
|
||||
Args []Vertex
|
||||
SeparatorTkns []*token.Token
|
||||
CloseParenthesisTkn *token.Token
|
||||
}
|
||||
@@ -1502,7 +1502,7 @@ type ExprMethodCall struct {
|
||||
Method Vertex
|
||||
CloseCurlyBracketTkn *token.Token
|
||||
OpenParenthesisTkn *token.Token
|
||||
Arguments []Vertex
|
||||
Args []Vertex
|
||||
SeparatorTkns []*token.Token
|
||||
CloseParenthesisTkn *token.Token
|
||||
}
|
||||
@@ -1521,7 +1521,7 @@ type ExprNew struct {
|
||||
NewTkn *token.Token
|
||||
Class Vertex
|
||||
OpenParenthesisTkn *token.Token
|
||||
Arguments []Vertex
|
||||
Args []Vertex
|
||||
SeparatorTkns []*token.Token
|
||||
CloseParenthesisTkn *token.Token
|
||||
}
|
||||
@@ -1615,7 +1615,7 @@ type ExprPropertyFetch struct {
|
||||
Var Vertex
|
||||
ObjectOperatorTkn *token.Token
|
||||
OpenCurlyBracketTkn *token.Token
|
||||
Property Vertex
|
||||
Prop Vertex
|
||||
CloseCurlyBracketTkn *token.Token
|
||||
}
|
||||
|
||||
@@ -1682,7 +1682,7 @@ type ExprStaticCall struct {
|
||||
Call Vertex
|
||||
CloseCurlyBracketTkn *token.Token
|
||||
OpenParenthesisTkn *token.Token
|
||||
Arguments []Vertex
|
||||
Args []Vertex
|
||||
SeparatorTkns []*token.Token
|
||||
CloseParenthesisTkn *token.Token
|
||||
}
|
||||
@@ -1700,7 +1700,7 @@ type ExprStaticPropertyFetch struct {
|
||||
Position *position.Position
|
||||
Class Vertex
|
||||
DoubleColonTkn *token.Token
|
||||
Property Vertex
|
||||
Prop Vertex
|
||||
}
|
||||
|
||||
func (n *ExprStaticPropertyFetch) Accept(v Visitor) {
|
||||
@@ -1714,7 +1714,7 @@ func (n *ExprStaticPropertyFetch) GetPosition() *position.Position {
|
||||
// ExprTernary node
|
||||
type ExprTernary struct {
|
||||
Position *position.Position
|
||||
Condition Vertex
|
||||
Cond Vertex
|
||||
QuestionTkn *token.Token
|
||||
IfTrue Vertex
|
||||
ColonTkn *token.Token
|
||||
@@ -1764,7 +1764,7 @@ type ExprVariable struct {
|
||||
Position *position.Position
|
||||
DollarTkn *token.Token
|
||||
OpenCurlyBracketTkn *token.Token
|
||||
VarName Vertex
|
||||
Name Vertex
|
||||
CloseCurlyBracketTkn *token.Token
|
||||
}
|
||||
|
||||
@@ -1782,7 +1782,7 @@ type ExprYield struct {
|
||||
YieldTkn *token.Token
|
||||
Key Vertex
|
||||
DoubleArrowTkn *token.Token
|
||||
Value Vertex
|
||||
Val Vertex
|
||||
}
|
||||
|
||||
func (n *ExprYield) Accept(v Visitor) {
|
||||
@@ -2586,17 +2586,17 @@ func (n *ExprBinarySpaceship) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
type NameName struct {
|
||||
type Name struct {
|
||||
Position *position.Position
|
||||
Parts []Vertex
|
||||
SeparatorTkns []*token.Token
|
||||
}
|
||||
|
||||
func (n *NameName) Accept(v Visitor) {
|
||||
func (n *Name) Accept(v Visitor) {
|
||||
v.NameName(n)
|
||||
}
|
||||
|
||||
func (n *NameName) GetPosition() *position.Position {
|
||||
func (n *Name) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
@@ -2631,16 +2631,16 @@ func (n *NameRelative) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
type NameNamePart struct {
|
||||
type NamePart struct {
|
||||
Position *position.Position
|
||||
StringTkn *token.Token
|
||||
Value []byte
|
||||
}
|
||||
|
||||
func (n *NameNamePart) Accept(v Visitor) {
|
||||
func (n *NamePart) Accept(v Visitor) {
|
||||
v.NameNamePart(n)
|
||||
}
|
||||
|
||||
func (n *NameNamePart) GetPosition() *position.Position {
|
||||
func (n *NamePart) GetPosition() *position.Position {
|
||||
return n.Position
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ func (v *Dumper) dumpToken(key string, tok *token.Token) {
|
||||
v.print(v.indent, "ID: token."+tok.ID.String()+",\n")
|
||||
}
|
||||
if tok.Value != nil {
|
||||
v.print(v.indent, "Value: []byte("+strconv.Quote(string(tok.Value))+"),\n")
|
||||
v.print(v.indent, "Val: []byte("+strconv.Quote(string(tok.Value))+"),\n")
|
||||
}
|
||||
v.dumpPosition(tok.Position)
|
||||
v.dumpTokenList("FreeFloating", tok.FreeFloating)
|
||||
@@ -209,7 +209,7 @@ func (v *Dumper) Identifier(n *ast.Identifier) {
|
||||
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpToken("IdentifierTkn", n.IdentifierTkn)
|
||||
v.dumpValue("Value", n.Value)
|
||||
v.dumpValue("Val", n.Value)
|
||||
|
||||
v.indent--
|
||||
v.print(v.indent, "},\n")
|
||||
@@ -281,9 +281,9 @@ func (v *Dumper) StmtClass(n *ast.StmtClass) {
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpVertexList("Modifiers", n.Modifiers)
|
||||
v.dumpToken("ClassTkn", n.ClassTkn)
|
||||
v.dumpVertex("ClassName", n.ClassName)
|
||||
v.dumpVertex("Name", n.Name)
|
||||
v.dumpToken("OpenParenthesisTkn", n.OpenParenthesisTkn)
|
||||
v.dumpVertexList("Arguments", n.Arguments)
|
||||
v.dumpVertexList("Args", n.Args)
|
||||
v.dumpTokenList("SeparatorTkns", n.SeparatorTkns)
|
||||
v.dumpToken("CloseParenthesisTkn", n.CloseParenthesisTkn)
|
||||
v.dumpToken("ExtendsTkn", n.ExtendsTkn)
|
||||
@@ -322,7 +322,7 @@ func (v *Dumper) StmtClassMethod(n *ast.StmtClassMethod) {
|
||||
v.dumpVertexList("Modifiers", n.Modifiers)
|
||||
v.dumpToken("FunctionTkn", n.FunctionTkn)
|
||||
v.dumpToken("AmpersandTkn", n.AmpersandTkn)
|
||||
v.dumpVertex("MethodName", n.MethodName)
|
||||
v.dumpVertex("Name", n.Name)
|
||||
v.dumpToken("OpenParenthesisTkn", n.OpenParenthesisTkn)
|
||||
v.dumpVertexList("Params", n.Params)
|
||||
v.dumpTokenList("SeparatorTkns", n.SeparatorTkns)
|
||||
@@ -549,7 +549,7 @@ func (v *Dumper) StmtFunction(n *ast.StmtFunction) {
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpToken("FunctionTkn", n.FunctionTkn)
|
||||
v.dumpToken("AmpersandTkn", n.AmpersandTkn)
|
||||
v.dumpVertex("FunctionName", n.FunctionName)
|
||||
v.dumpVertex("Name", n.Name)
|
||||
v.dumpToken("OpenParenthesisTkn", n.OpenParenthesisTkn)
|
||||
v.dumpVertexList("Params", n.Params)
|
||||
v.dumpTokenList("SeparatorTkns", n.SeparatorTkns)
|
||||
@@ -631,7 +631,7 @@ func (v *Dumper) StmtInlineHtml(n *ast.StmtInlineHtml) {
|
||||
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpToken("InlineHtmlTkn", n.InlineHtmlTkn)
|
||||
v.dumpValue("Value", n.Value)
|
||||
v.dumpValue("Val", n.Value)
|
||||
|
||||
v.indent--
|
||||
v.print(v.indent, "},\n")
|
||||
@@ -643,7 +643,7 @@ func (v *Dumper) StmtInterface(n *ast.StmtInterface) {
|
||||
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpToken("InterfaceTkn", n.InterfaceTkn)
|
||||
v.dumpVertex("InterfaceName", n.InterfaceName)
|
||||
v.dumpVertex("Name", n.Name)
|
||||
v.dumpToken("ExtendsTkn", n.ExtendsTkn)
|
||||
v.dumpVertexList("Extends", n.Extends)
|
||||
v.dumpTokenList("ExtendsSeparatorTkns", n.ExtendsSeparatorTkns)
|
||||
@@ -660,7 +660,7 @@ func (v *Dumper) StmtLabel(n *ast.StmtLabel) {
|
||||
v.indent++
|
||||
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpVertex("LabelName", n.LabelName)
|
||||
v.dumpVertex("Name", n.Name)
|
||||
v.dumpToken("ColonTkn", n.ColonTkn)
|
||||
|
||||
v.indent--
|
||||
@@ -714,7 +714,7 @@ func (v *Dumper) StmtPropertyList(n *ast.StmtPropertyList) {
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpVertexList("Modifiers", n.Modifiers)
|
||||
v.dumpVertex("Type", n.Type)
|
||||
v.dumpVertexList("Properties", n.Properties)
|
||||
v.dumpVertexList("Props", n.Props)
|
||||
v.dumpTokenList("SeparatorTkns", n.SeparatorTkns)
|
||||
v.dumpToken("SemiColonTkn", n.SemiColonTkn)
|
||||
|
||||
@@ -787,7 +787,7 @@ func (v *Dumper) StmtSwitch(n *ast.StmtSwitch) {
|
||||
v.dumpToken("ColonTkn", n.ColonTkn)
|
||||
v.dumpToken("OpenCurlyBracketTkn", n.OpenCurlyBracketTkn)
|
||||
v.dumpToken("CaseSeparatorTkn", n.CaseSeparatorTkn)
|
||||
v.dumpVertexList("CaseList", n.CaseList)
|
||||
v.dumpVertexList("Cases", n.Cases)
|
||||
v.dumpToken("CloseCurlyBracketTkn", n.CloseCurlyBracketTkn)
|
||||
v.dumpToken("EndSwitchTkn", n.EndSwitchTkn)
|
||||
v.dumpToken("SemiColonTkn", n.SemiColonTkn)
|
||||
@@ -815,7 +815,7 @@ func (v *Dumper) StmtTrait(n *ast.StmtTrait) {
|
||||
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpToken("TraitTkn", n.TraitTkn)
|
||||
v.dumpVertex("TraitName", n.TraitName)
|
||||
v.dumpVertex("Name", n.Name)
|
||||
v.dumpToken("OpenCurlyBracketTkn", n.OpenCurlyBracketTkn)
|
||||
v.dumpVertexList("Stmts", n.Stmts)
|
||||
v.dumpToken("CloseCurlyBracketTkn", n.CloseCurlyBracketTkn)
|
||||
@@ -907,14 +907,14 @@ func (v *Dumper) StmtUnset(n *ast.StmtUnset) {
|
||||
v.print(v.indent, "},\n")
|
||||
}
|
||||
|
||||
func (v *Dumper) StmtUse(n *ast.StmtUse) {
|
||||
v.print(0, "&ast.StmtUse{\n")
|
||||
func (v *Dumper) StmtUse(n *ast.StmtUseList) {
|
||||
v.print(0, "&ast.StmtUseList{\n")
|
||||
v.indent++
|
||||
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpToken("UseTkn", n.UseTkn)
|
||||
v.dumpVertex("Type", n.Type)
|
||||
v.dumpVertexList("UseDeclarations", n.UseDeclarations)
|
||||
v.dumpVertexList("Uses", n.Uses)
|
||||
v.dumpTokenList("SeparatorTkns", n.SeparatorTkns)
|
||||
v.dumpToken("SemiColonTkn", n.SemiColonTkn)
|
||||
|
||||
@@ -922,8 +922,8 @@ func (v *Dumper) StmtUse(n *ast.StmtUse) {
|
||||
v.print(v.indent, "},\n")
|
||||
}
|
||||
|
||||
func (v *Dumper) StmtGroupUse(n *ast.StmtGroupUse) {
|
||||
v.print(0, "&ast.StmtGroupUse{\n")
|
||||
func (v *Dumper) StmtGroupUse(n *ast.StmtGroupUseList) {
|
||||
v.print(0, "&ast.StmtGroupUseList{\n")
|
||||
v.indent++
|
||||
|
||||
v.dumpPosition(n.Position)
|
||||
@@ -933,7 +933,7 @@ func (v *Dumper) StmtGroupUse(n *ast.StmtGroupUse) {
|
||||
v.dumpVertex("Prefix", n.Prefix)
|
||||
v.dumpToken("NsSeparatorTkn", n.NsSeparatorTkn)
|
||||
v.dumpToken("OpenCurlyBracketTkn", n.OpenCurlyBracketTkn)
|
||||
v.dumpVertexList("UseDeclarations", n.UseDeclarations)
|
||||
v.dumpVertexList("Uses", n.Uses)
|
||||
v.dumpTokenList("SeparatorTkns", n.SeparatorTkns)
|
||||
v.dumpToken("CloseCurlyBracketTkn", n.CloseCurlyBracketTkn)
|
||||
v.dumpToken("SemiColonTkn", n.SemiColonTkn)
|
||||
@@ -942,14 +942,14 @@ func (v *Dumper) StmtGroupUse(n *ast.StmtGroupUse) {
|
||||
v.print(v.indent, "},\n")
|
||||
}
|
||||
|
||||
func (v *Dumper) StmtUseDeclaration(n *ast.StmtUseDeclaration) {
|
||||
v.print(0, "&ast.StmtUseDeclaration{\n")
|
||||
func (v *Dumper) StmtUseDeclaration(n *ast.StmtUse) {
|
||||
v.print(0, "&ast.StmtUse{\n")
|
||||
v.indent++
|
||||
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpVertex("Type", n.Type)
|
||||
v.dumpToken("NsSeparatorTkn", n.NsSeparatorTkn)
|
||||
v.dumpVertex("Use", n.Use)
|
||||
v.dumpVertex("Uses", n.Use)
|
||||
v.dumpToken("AsTkn", n.AsTkn)
|
||||
v.dumpVertex("Alias", n.Alias)
|
||||
|
||||
@@ -1084,7 +1084,7 @@ func (v *Dumper) ExprClassConstFetch(n *ast.ExprClassConstFetch) {
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpVertex("Class", n.Class)
|
||||
v.dumpToken("DoubleColonTkn", n.DoubleColonTkn)
|
||||
v.dumpVertex("ConstantName", n.ConstantName)
|
||||
v.dumpVertex("Const", n.Const)
|
||||
|
||||
v.indent--
|
||||
v.print(v.indent, "},\n")
|
||||
@@ -1116,7 +1116,7 @@ func (v *Dumper) ExprClosure(n *ast.ExprClosure) {
|
||||
v.dumpToken("CloseParenthesisTkn", n.CloseParenthesisTkn)
|
||||
v.dumpToken("UseTkn", n.UseTkn)
|
||||
v.dumpToken("UseOpenParenthesisTkn", n.UseOpenParenthesisTkn)
|
||||
v.dumpVertexList("Use", n.Use)
|
||||
v.dumpVertexList("Uses", n.Uses)
|
||||
v.dumpTokenList("UseSeparatorTkns", n.UseSeparatorTkns)
|
||||
v.dumpToken("UseCloseParenthesisTkn", n.UseCloseParenthesisTkn)
|
||||
v.dumpToken("ColonTkn", n.ColonTkn)
|
||||
@@ -1213,7 +1213,7 @@ func (v *Dumper) ExprFunctionCall(n *ast.ExprFunctionCall) {
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpVertex("Function", n.Function)
|
||||
v.dumpToken("OpenParenthesisTkn", n.OpenParenthesisTkn)
|
||||
v.dumpVertexList("Arguments", n.Arguments)
|
||||
v.dumpVertexList("Args", n.Args)
|
||||
v.dumpTokenList("SeparatorTkns", n.SeparatorTkns)
|
||||
v.dumpToken("CloseParenthesisTkn", n.CloseParenthesisTkn)
|
||||
|
||||
@@ -1299,7 +1299,7 @@ func (v *Dumper) ExprMethodCall(n *ast.ExprMethodCall) {
|
||||
v.dumpVertex("Method", n.Method)
|
||||
v.dumpToken("CloseCurlyBracketTkn", n.CloseCurlyBracketTkn)
|
||||
v.dumpToken("OpenParenthesisTkn", n.OpenParenthesisTkn)
|
||||
v.dumpVertexList("Arguments", n.Arguments)
|
||||
v.dumpVertexList("Args", n.Args)
|
||||
v.dumpTokenList("SeparatorTkns", n.SeparatorTkns)
|
||||
v.dumpToken("CloseParenthesisTkn", n.CloseParenthesisTkn)
|
||||
|
||||
@@ -1315,7 +1315,7 @@ func (v *Dumper) ExprNew(n *ast.ExprNew) {
|
||||
v.dumpToken("NewTkn", n.NewTkn)
|
||||
v.dumpVertex("Class", n.Class)
|
||||
v.dumpToken("OpenParenthesisTkn", n.OpenParenthesisTkn)
|
||||
v.dumpVertexList("Arguments", n.Arguments)
|
||||
v.dumpVertexList("Args", n.Args)
|
||||
v.dumpTokenList("SeparatorTkns", n.SeparatorTkns)
|
||||
v.dumpToken("CloseParenthesisTkn", n.CloseParenthesisTkn)
|
||||
|
||||
@@ -1391,7 +1391,7 @@ func (v *Dumper) ExprPropertyFetch(n *ast.ExprPropertyFetch) {
|
||||
v.dumpVertex("Var", n.Var)
|
||||
v.dumpToken("ObjectOperatorTkn", n.ObjectOperatorTkn)
|
||||
v.dumpToken("OpenCurlyBracketTkn", n.OpenCurlyBracketTkn)
|
||||
v.dumpVertex("Property", n.Property)
|
||||
v.dumpVertex("Prop", n.Prop)
|
||||
v.dumpToken("CloseCurlyBracketTkn", n.CloseCurlyBracketTkn)
|
||||
|
||||
v.indent--
|
||||
@@ -1446,7 +1446,7 @@ func (v *Dumper) ExprStaticCall(n *ast.ExprStaticCall) {
|
||||
v.dumpVertex("Call", n.Call)
|
||||
v.dumpToken("CloseCurlyBracketTkn", n.CloseCurlyBracketTkn)
|
||||
v.dumpToken("OpenParenthesisTkn", n.OpenParenthesisTkn)
|
||||
v.dumpVertexList("Arguments", n.Arguments)
|
||||
v.dumpVertexList("Args", n.Args)
|
||||
v.dumpTokenList("SeparatorTkns", n.SeparatorTkns)
|
||||
v.dumpToken("CloseParenthesisTkn", n.CloseParenthesisTkn)
|
||||
|
||||
@@ -1461,7 +1461,7 @@ func (v *Dumper) ExprStaticPropertyFetch(n *ast.ExprStaticPropertyFetch) {
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpVertex("Class", n.Class)
|
||||
v.dumpToken("DoubleColonTkn", n.DoubleColonTkn)
|
||||
v.dumpVertex("Property", n.Property)
|
||||
v.dumpVertex("Prop", n.Prop)
|
||||
|
||||
v.indent--
|
||||
v.print(v.indent, "},\n")
|
||||
@@ -1472,7 +1472,7 @@ func (v *Dumper) ExprTernary(n *ast.ExprTernary) {
|
||||
v.indent++
|
||||
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpVertex("Condition", n.Condition)
|
||||
v.dumpVertex("Cond", n.Cond)
|
||||
v.dumpToken("QuestionTkn", n.QuestionTkn)
|
||||
v.dumpVertex("IfTrue", n.IfTrue)
|
||||
v.dumpToken("ColonTkn", n.ColonTkn)
|
||||
@@ -1513,7 +1513,7 @@ func (v *Dumper) ExprVariable(n *ast.ExprVariable) {
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpToken("DollarTkn", n.DollarTkn)
|
||||
v.dumpToken("OpenCurlyBracketTkn", n.OpenCurlyBracketTkn)
|
||||
v.dumpVertex("VarName", n.VarName)
|
||||
v.dumpVertex("Name", n.Name)
|
||||
v.dumpToken("CloseCurlyBracketTkn", n.CloseCurlyBracketTkn)
|
||||
|
||||
v.indent--
|
||||
@@ -1528,7 +1528,7 @@ func (v *Dumper) ExprYield(n *ast.ExprYield) {
|
||||
v.dumpToken("YieldTkn", n.YieldTkn)
|
||||
v.dumpVertex("Key", n.Key)
|
||||
v.dumpToken("DoubleArrowTkn", n.DoubleArrowTkn)
|
||||
v.dumpVertex("Value", n.Value)
|
||||
v.dumpVertex("Val", n.Val)
|
||||
|
||||
v.indent--
|
||||
v.print(v.indent, "},\n")
|
||||
@@ -2183,7 +2183,7 @@ func (v *Dumper) ScalarDnumber(n *ast.ScalarDnumber) {
|
||||
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpToken("NumberTkn", n.NumberTkn)
|
||||
v.dumpValue("Value", n.Value)
|
||||
v.dumpValue("Val", n.Value)
|
||||
|
||||
v.indent--
|
||||
v.print(v.indent, "},\n")
|
||||
@@ -2208,7 +2208,7 @@ func (v *Dumper) ScalarEncapsedStringPart(n *ast.ScalarEncapsedStringPart) {
|
||||
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpToken("EncapsedStrTkn", n.EncapsedStrTkn)
|
||||
v.dumpValue("Value", n.Value)
|
||||
v.dumpValue("Val", n.Value)
|
||||
|
||||
v.indent--
|
||||
v.print(v.indent, "},\n")
|
||||
@@ -2220,7 +2220,7 @@ func (v *Dumper) ScalarEncapsedStringVar(n *ast.ScalarEncapsedStringVar) {
|
||||
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpToken("DollarOpenCurlyBracketTkn", n.DollarOpenCurlyBracketTkn)
|
||||
v.dumpVertex("VarName", n.VarName)
|
||||
v.dumpVertex("Name", n.Name)
|
||||
v.dumpToken("OpenSquareBracketTkn", n.OpenSquareBracketTkn)
|
||||
v.dumpVertex("Dim", n.Dim)
|
||||
v.dumpToken("CloseSquareBracketTkn", n.CloseSquareBracketTkn)
|
||||
@@ -2262,7 +2262,7 @@ func (v *Dumper) ScalarLnumber(n *ast.ScalarLnumber) {
|
||||
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpToken("NumberTkn", n.NumberTkn)
|
||||
v.dumpValue("Value", n.Value)
|
||||
v.dumpValue("Val", n.Value)
|
||||
|
||||
v.indent--
|
||||
v.print(v.indent, "},\n")
|
||||
@@ -2274,7 +2274,7 @@ func (v *Dumper) ScalarMagicConstant(n *ast.ScalarMagicConstant) {
|
||||
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpToken("MagicConstTkn", n.MagicConstTkn)
|
||||
v.dumpValue("Value", n.Value)
|
||||
v.dumpValue("Val", n.Value)
|
||||
|
||||
v.indent--
|
||||
v.print(v.indent, "},\n")
|
||||
@@ -2287,14 +2287,14 @@ func (v *Dumper) ScalarString(n *ast.ScalarString) {
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpToken("MinusTkn", n.MinusTkn)
|
||||
v.dumpToken("StringTkn", n.StringTkn)
|
||||
v.dumpValue("Value", n.Value)
|
||||
v.dumpValue("Val", n.Value)
|
||||
|
||||
v.indent--
|
||||
v.print(v.indent, "},\n")
|
||||
}
|
||||
|
||||
func (v *Dumper) NameName(n *ast.NameName) {
|
||||
v.print(0, "&ast.NameName{\n")
|
||||
func (v *Dumper) NameName(n *ast.Name) {
|
||||
v.print(0, "&ast.Name{\n")
|
||||
v.indent++
|
||||
|
||||
v.dumpPosition(n.Position)
|
||||
@@ -2332,13 +2332,13 @@ func (v *Dumper) NameRelative(n *ast.NameRelative) {
|
||||
v.print(v.indent, "},\n")
|
||||
}
|
||||
|
||||
func (v *Dumper) NameNamePart(n *ast.NameNamePart) {
|
||||
v.print(0, "&ast.NameNamePart{\n")
|
||||
func (v *Dumper) NameNamePart(n *ast.NamePart) {
|
||||
v.print(0, "&ast.NamePart{\n")
|
||||
v.indent++
|
||||
|
||||
v.dumpPosition(n.Position)
|
||||
v.dumpToken("StringTkn", n.StringTkn)
|
||||
v.dumpValue("Value", n.Value)
|
||||
v.dumpValue("Val", n.Value)
|
||||
|
||||
v.indent--
|
||||
v.print(v.indent, "},\n")
|
||||
|
||||
@@ -56,7 +56,7 @@ func TestDumper_root(t *testing.T) {
|
||||
FreeFloating: []*token.Token{
|
||||
{
|
||||
ID: token.T_WHITESPACE,
|
||||
Value: []byte(" "),
|
||||
Val: []byte(" "),
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 2,
|
||||
|
||||
@@ -267,14 +267,14 @@ func (f *formatter) StmtClass(n *ast.StmtClass) {
|
||||
n.ClassTkn = f.newToken(token.T_CLASS, []byte("class"))
|
||||
|
||||
f.addFreeFloating(token.T_WHITESPACE, []byte(" "))
|
||||
n.ClassName.Accept(f)
|
||||
n.Name.Accept(f)
|
||||
|
||||
n.OpenParenthesisTkn = nil
|
||||
n.CloseParenthesisTkn = nil
|
||||
if len(n.Arguments) > 0 {
|
||||
if len(n.Args) > 0 {
|
||||
n.OpenParenthesisTkn = f.newToken('(', []byte("("))
|
||||
|
||||
n.SeparatorTkns = f.formatList(n.Arguments, ',')
|
||||
n.SeparatorTkns = f.formatList(n.Args, ',')
|
||||
|
||||
n.CloseParenthesisTkn = f.newToken(')', []byte(")"))
|
||||
}
|
||||
@@ -333,7 +333,7 @@ func (f *formatter) StmtClassMethod(n *ast.StmtClassMethod) {
|
||||
n.AmpersandTkn = f.newToken('&', []byte("&"))
|
||||
}
|
||||
|
||||
n.MethodName.Accept(f)
|
||||
n.Name.Accept(f)
|
||||
|
||||
n.OpenParenthesisTkn = f.newToken('(', []byte("("))
|
||||
|
||||
@@ -564,7 +564,7 @@ func (f *formatter) StmtFunction(n *ast.StmtFunction) {
|
||||
n.AmpersandTkn = f.newToken('&', []byte("&"))
|
||||
}
|
||||
|
||||
n.FunctionName.Accept(f)
|
||||
n.Name.Accept(f)
|
||||
|
||||
n.OpenParenthesisTkn = f.newToken('(', []byte("("))
|
||||
|
||||
@@ -661,7 +661,7 @@ func (f *formatter) StmtInterface(n *ast.StmtInterface) {
|
||||
n.InterfaceTkn = f.newToken(token.T_INTERFACE, []byte("interface"))
|
||||
f.addFreeFloating(token.T_WHITESPACE, []byte(" "))
|
||||
|
||||
n.InterfaceName.Accept(f)
|
||||
n.Name.Accept(f)
|
||||
f.addFreeFloating(token.T_WHITESPACE, []byte(" "))
|
||||
|
||||
if n.Extends != nil {
|
||||
@@ -685,7 +685,7 @@ func (f *formatter) StmtInterface(n *ast.StmtInterface) {
|
||||
}
|
||||
|
||||
func (f *formatter) StmtLabel(n *ast.StmtLabel) {
|
||||
n.LabelName.Accept(f)
|
||||
n.Name.Accept(f)
|
||||
n.ColonTkn = f.newToken(':', []byte(":"))
|
||||
}
|
||||
|
||||
@@ -746,7 +746,7 @@ func (f *formatter) StmtPropertyList(n *ast.StmtPropertyList) {
|
||||
f.addFreeFloating(token.T_WHITESPACE, []byte(" "))
|
||||
}
|
||||
|
||||
n.SeparatorTkns = f.formatList(n.Properties, ',')
|
||||
n.SeparatorTkns = f.formatList(n.Props, ',')
|
||||
|
||||
n.SemiColonTkn = f.newSemicolonTkn()
|
||||
}
|
||||
@@ -816,9 +816,9 @@ func (f *formatter) StmtSwitch(n *ast.StmtSwitch) {
|
||||
f.addFreeFloating(token.T_WHITESPACE, []byte(" "))
|
||||
n.OpenCurlyBracketTkn = f.newToken('{', []byte("{"))
|
||||
|
||||
if len(n.CaseList) > 0 {
|
||||
if len(n.Cases) > 0 {
|
||||
f.indent++
|
||||
f.formatStmts(&n.CaseList)
|
||||
f.formatStmts(&n.Cases)
|
||||
f.indent--
|
||||
|
||||
f.addFreeFloating(token.T_WHITESPACE, []byte("\n"))
|
||||
@@ -841,7 +841,7 @@ func (f *formatter) StmtTrait(n *ast.StmtTrait) {
|
||||
n.TraitTkn = f.newToken(token.T_TRAIT, []byte("trait"))
|
||||
f.addFreeFloating(token.T_WHITESPACE, []byte(" "))
|
||||
|
||||
n.TraitName.Accept(f)
|
||||
n.Name.Accept(f)
|
||||
f.addFreeFloating(token.T_WHITESPACE, []byte(" "))
|
||||
|
||||
n.OpenCurlyBracketTkn = f.newToken('{', []byte("{"))
|
||||
@@ -964,7 +964,7 @@ func (f *formatter) StmtUnset(n *ast.StmtUnset) {
|
||||
n.SemiColonTkn = f.newSemicolonTkn()
|
||||
}
|
||||
|
||||
func (f *formatter) StmtUse(n *ast.StmtUse) {
|
||||
func (f *formatter) StmtUse(n *ast.StmtUseList) {
|
||||
n.UseTkn = f.newToken(token.T_USE, []byte("use"))
|
||||
f.addFreeFloating(token.T_WHITESPACE, []byte(" "))
|
||||
|
||||
@@ -973,12 +973,12 @@ func (f *formatter) StmtUse(n *ast.StmtUse) {
|
||||
f.addFreeFloating(token.T_WHITESPACE, []byte(" "))
|
||||
}
|
||||
|
||||
n.SeparatorTkns = f.formatList(n.UseDeclarations, ',')
|
||||
n.SeparatorTkns = f.formatList(n.Uses, ',')
|
||||
|
||||
n.SemiColonTkn = f.newSemicolonTkn()
|
||||
}
|
||||
|
||||
func (f *formatter) StmtGroupUse(n *ast.StmtGroupUse) {
|
||||
func (f *formatter) StmtGroupUse(n *ast.StmtGroupUseList) {
|
||||
n.UseTkn = f.newToken(token.T_USE, []byte("use"))
|
||||
f.addFreeFloating(token.T_WHITESPACE, []byte(" "))
|
||||
|
||||
@@ -993,13 +993,13 @@ func (f *formatter) StmtGroupUse(n *ast.StmtGroupUse) {
|
||||
n.NsSeparatorTkn = f.newToken(token.T_NS_SEPARATOR, []byte("\\"))
|
||||
|
||||
n.OpenCurlyBracketTkn = f.newToken('{', []byte("{"))
|
||||
n.SeparatorTkns = f.formatList(n.UseDeclarations, ',')
|
||||
n.SeparatorTkns = f.formatList(n.Uses, ',')
|
||||
n.CloseCurlyBracketTkn = f.newToken('}', []byte("}"))
|
||||
|
||||
n.SemiColonTkn = f.newSemicolonTkn()
|
||||
}
|
||||
|
||||
func (f *formatter) StmtUseDeclaration(n *ast.StmtUseDeclaration) {
|
||||
func (f *formatter) StmtUseDeclaration(n *ast.StmtUse) {
|
||||
if n.Type != nil {
|
||||
n.Type.Accept(f)
|
||||
f.addFreeFloating(token.T_WHITESPACE, []byte(" "))
|
||||
@@ -1113,7 +1113,7 @@ func (f *formatter) ExprBrackets(n *ast.ExprBrackets) {
|
||||
func (f *formatter) ExprClassConstFetch(n *ast.ExprClassConstFetch) {
|
||||
n.Class.Accept(f)
|
||||
n.DoubleColonTkn = f.newToken(token.T_PAAMAYIM_NEKUDOTAYIM, []byte("::"))
|
||||
n.ConstantName.Accept(f)
|
||||
n.Const.Accept(f)
|
||||
}
|
||||
|
||||
func (f *formatter) ExprClone(n *ast.ExprClone) {
|
||||
@@ -1145,11 +1145,11 @@ func (f *formatter) ExprClosure(n *ast.ExprClosure) {
|
||||
n.UseOpenParenthesisTkn = nil
|
||||
n.UseCloseParenthesisTkn = nil
|
||||
n.UseSeparatorTkns = nil
|
||||
if len(n.Use) > 0 {
|
||||
if len(n.Uses) > 0 {
|
||||
f.addFreeFloating(token.T_WHITESPACE, []byte(" "))
|
||||
n.UseTkn = f.newToken(token.T_USE, []byte("use"))
|
||||
n.OpenParenthesisTkn = f.newToken('(', []byte("("))
|
||||
n.SeparatorTkns = f.formatList(n.Use, ',')
|
||||
n.SeparatorTkns = f.formatList(n.Uses, ',')
|
||||
n.CloseParenthesisTkn = f.newToken(')', []byte(")"))
|
||||
}
|
||||
|
||||
@@ -1221,8 +1221,8 @@ func (f *formatter) ExprFunctionCall(n *ast.ExprFunctionCall) {
|
||||
n.Function.Accept(f)
|
||||
n.OpenParenthesisTkn = f.newToken('(', []byte("("))
|
||||
n.SeparatorTkns = nil
|
||||
if len(n.Arguments) > 0 {
|
||||
n.SeparatorTkns = f.formatList(n.Arguments, ',')
|
||||
if len(n.Args) > 0 {
|
||||
n.SeparatorTkns = f.formatList(n.Args, ',')
|
||||
}
|
||||
n.CloseParenthesisTkn = f.newToken(')', []byte(")"))
|
||||
}
|
||||
@@ -1281,8 +1281,8 @@ func (f *formatter) ExprMethodCall(n *ast.ExprMethodCall) {
|
||||
|
||||
n.OpenParenthesisTkn = f.newToken('(', []byte("("))
|
||||
n.SeparatorTkns = nil
|
||||
if len(n.Arguments) > 0 {
|
||||
n.SeparatorTkns = f.formatList(n.Arguments, ',')
|
||||
if len(n.Args) > 0 {
|
||||
n.SeparatorTkns = f.formatList(n.Args, ',')
|
||||
}
|
||||
n.CloseParenthesisTkn = f.newToken(')', []byte(")"))
|
||||
}
|
||||
@@ -1296,9 +1296,9 @@ func (f *formatter) ExprNew(n *ast.ExprNew) {
|
||||
n.SeparatorTkns = nil
|
||||
n.OpenParenthesisTkn = nil
|
||||
n.CloseParenthesisTkn = nil
|
||||
if len(n.Arguments) > 0 {
|
||||
if len(n.Args) > 0 {
|
||||
n.OpenParenthesisTkn = f.newToken('(', []byte("("))
|
||||
n.SeparatorTkns = f.formatList(n.Arguments, ',')
|
||||
n.SeparatorTkns = f.formatList(n.Args, ',')
|
||||
n.CloseParenthesisTkn = f.newToken(')', []byte(")"))
|
||||
}
|
||||
}
|
||||
@@ -1336,7 +1336,7 @@ func (f *formatter) ExprPropertyFetch(n *ast.ExprPropertyFetch) {
|
||||
|
||||
n.OpenCurlyBracketTkn = nil
|
||||
n.CloseCurlyBracketTkn = nil
|
||||
switch n.Property.(type) {
|
||||
switch n.Prop.(type) {
|
||||
case *ast.Identifier:
|
||||
case *ast.ExprVariable:
|
||||
default:
|
||||
@@ -1344,7 +1344,7 @@ func (f *formatter) ExprPropertyFetch(n *ast.ExprPropertyFetch) {
|
||||
n.CloseCurlyBracketTkn = f.newToken('}', []byte("}"))
|
||||
}
|
||||
|
||||
n.Property.Accept(f)
|
||||
n.Prop.Accept(f)
|
||||
}
|
||||
|
||||
func (f *formatter) ExprRequire(n *ast.ExprRequire) {
|
||||
@@ -1385,8 +1385,8 @@ func (f *formatter) ExprStaticCall(n *ast.ExprStaticCall) {
|
||||
|
||||
n.OpenParenthesisTkn = f.newToken('(', []byte("("))
|
||||
n.SeparatorTkns = nil
|
||||
if len(n.Arguments) > 0 {
|
||||
n.SeparatorTkns = f.formatList(n.Arguments, ',')
|
||||
if len(n.Args) > 0 {
|
||||
n.SeparatorTkns = f.formatList(n.Args, ',')
|
||||
}
|
||||
n.CloseParenthesisTkn = f.newToken(')', []byte(")"))
|
||||
}
|
||||
@@ -1394,11 +1394,11 @@ func (f *formatter) ExprStaticCall(n *ast.ExprStaticCall) {
|
||||
func (f *formatter) ExprStaticPropertyFetch(n *ast.ExprStaticPropertyFetch) {
|
||||
n.Class.Accept(f)
|
||||
n.DoubleColonTkn = f.newToken(token.T_PAAMAYIM_NEKUDOTAYIM, []byte("::"))
|
||||
n.Property.Accept(f)
|
||||
n.Prop.Accept(f)
|
||||
}
|
||||
|
||||
func (f *formatter) ExprTernary(n *ast.ExprTernary) {
|
||||
n.Condition.Accept(f)
|
||||
n.Cond.Accept(f)
|
||||
f.addFreeFloating(token.T_WHITESPACE, []byte(" "))
|
||||
n.QuestionTkn = f.newToken('?', []byte("?"))
|
||||
if n.IfTrue != nil {
|
||||
@@ -1422,13 +1422,13 @@ func (f *formatter) ExprUnaryPlus(n *ast.ExprUnaryPlus) {
|
||||
}
|
||||
|
||||
func (f *formatter) ExprVariable(n *ast.ExprVariable) {
|
||||
if _, ok := n.VarName.(*ast.Identifier); !ok {
|
||||
if _, ok := n.Name.(*ast.Identifier); !ok {
|
||||
n.DollarTkn = f.newToken('$', []byte("$"))
|
||||
}
|
||||
|
||||
n.OpenCurlyBracketTkn = nil
|
||||
n.CloseCurlyBracketTkn = nil
|
||||
switch n.VarName.(type) {
|
||||
switch n.Name.(type) {
|
||||
case *ast.Identifier:
|
||||
case *ast.ExprVariable:
|
||||
default:
|
||||
@@ -1436,7 +1436,7 @@ func (f *formatter) ExprVariable(n *ast.ExprVariable) {
|
||||
n.CloseCurlyBracketTkn = f.newToken('}', []byte("}"))
|
||||
}
|
||||
|
||||
n.VarName.Accept(f)
|
||||
n.Name.Accept(f)
|
||||
}
|
||||
|
||||
func (f *formatter) ExprYield(n *ast.ExprYield) {
|
||||
@@ -1450,7 +1450,7 @@ func (f *formatter) ExprYield(n *ast.ExprYield) {
|
||||
f.addFreeFloating(token.T_WHITESPACE, []byte(" "))
|
||||
}
|
||||
|
||||
n.Value.Accept(f)
|
||||
n.Val.Accept(f)
|
||||
}
|
||||
|
||||
func (f *formatter) ExprYieldFrom(n *ast.ExprYieldFrom) {
|
||||
@@ -1942,7 +1942,7 @@ func (f *formatter) ScalarEncapsedStringPart(n *ast.ScalarEncapsedStringPart) {
|
||||
|
||||
func (f *formatter) ScalarEncapsedStringVar(n *ast.ScalarEncapsedStringVar) {
|
||||
n.DollarOpenCurlyBracketTkn = f.newToken(token.T_DOLLAR_OPEN_CURLY_BRACES, []byte("${"))
|
||||
n.VarName.Accept(f)
|
||||
n.Name.Accept(f)
|
||||
|
||||
n.OpenSquareBracketTkn = nil
|
||||
n.CloseSquareBracketTkn = nil
|
||||
@@ -1993,7 +1993,7 @@ func (f *formatter) ScalarString(n *ast.ScalarString) {
|
||||
}
|
||||
}
|
||||
|
||||
func (f *formatter) NameName(n *ast.NameName) {
|
||||
func (f *formatter) NameName(n *ast.Name) {
|
||||
separatorTkns := make([]*token.Token, len(n.Parts)-1)
|
||||
for i, v := range n.Parts {
|
||||
v.Accept(f)
|
||||
@@ -2031,7 +2031,7 @@ func (f *formatter) NameRelative(n *ast.NameRelative) {
|
||||
}
|
||||
}
|
||||
|
||||
func (f *formatter) NameNamePart(n *ast.NameNamePart) {
|
||||
func (f *formatter) NameNamePart(n *ast.NamePart) {
|
||||
if n.StringTkn == nil {
|
||||
n.StringTkn = f.newToken(token.T_STRING, n.Value)
|
||||
} else {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -41,32 +41,32 @@ func (nsr *NamespaceResolver) StmtNamespace(n *ast.StmtNamespace) {
|
||||
if n.Name == nil {
|
||||
nsr.Namespace = NewNamespace("")
|
||||
} else {
|
||||
NSParts := n.Name.(*ast.NameName).Parts
|
||||
NSParts := n.Name.(*ast.Name).Parts
|
||||
nsr.Namespace = NewNamespace(concatNameParts(NSParts))
|
||||
}
|
||||
}
|
||||
|
||||
func (nsr *NamespaceResolver) StmtUse(n *ast.StmtUse) {
|
||||
func (nsr *NamespaceResolver) StmtUse(n *ast.StmtUseList) {
|
||||
useType := ""
|
||||
if n.Type != nil {
|
||||
useType = string(n.Type.(*ast.Identifier).Value)
|
||||
}
|
||||
|
||||
for _, nn := range n.UseDeclarations {
|
||||
for _, nn := range n.Uses {
|
||||
nsr.AddAlias(useType, nn, nil)
|
||||
}
|
||||
|
||||
nsr.goDeep = false
|
||||
}
|
||||
|
||||
func (nsr *NamespaceResolver) StmtGroupUse(n *ast.StmtGroupUse) {
|
||||
func (nsr *NamespaceResolver) StmtGroupUse(n *ast.StmtGroupUseList) {
|
||||
useType := ""
|
||||
if n.Type != nil {
|
||||
useType = string(n.Type.(*ast.Identifier).Value)
|
||||
}
|
||||
|
||||
for _, nn := range n.UseDeclarations {
|
||||
nsr.AddAlias(useType, nn, n.Prefix.(*ast.NameName).Parts)
|
||||
for _, nn := range n.Uses {
|
||||
nsr.AddAlias(useType, nn, n.Prefix.(*ast.Name).Parts)
|
||||
}
|
||||
|
||||
nsr.goDeep = false
|
||||
@@ -83,8 +83,8 @@ func (nsr *NamespaceResolver) StmtClass(n *ast.StmtClass) {
|
||||
}
|
||||
}
|
||||
|
||||
if n.ClassName != nil {
|
||||
nsr.AddNamespacedName(n, string(n.ClassName.(*ast.Identifier).Value))
|
||||
if n.Name != nil {
|
||||
nsr.AddNamespacedName(n, string(n.Name.(*ast.Identifier).Value))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,15 +95,15 @@ func (nsr *NamespaceResolver) StmtInterface(n *ast.StmtInterface) {
|
||||
}
|
||||
}
|
||||
|
||||
nsr.AddNamespacedName(n, string(n.InterfaceName.(*ast.Identifier).Value))
|
||||
nsr.AddNamespacedName(n, string(n.Name.(*ast.Identifier).Value))
|
||||
}
|
||||
|
||||
func (nsr *NamespaceResolver) StmtTrait(n *ast.StmtTrait) {
|
||||
nsr.AddNamespacedName(n, string(n.TraitName.(*ast.Identifier).Value))
|
||||
nsr.AddNamespacedName(n, string(n.Name.(*ast.Identifier).Value))
|
||||
}
|
||||
|
||||
func (nsr *NamespaceResolver) StmtFunction(n *ast.StmtFunction) {
|
||||
nsr.AddNamespacedName(n, string(n.FunctionName.(*ast.Identifier).Value))
|
||||
nsr.AddNamespacedName(n, string(n.Name.(*ast.Identifier).Value))
|
||||
|
||||
for _, parameter := range n.Params {
|
||||
nsr.ResolveType(parameter.(*ast.Parameter).Type)
|
||||
@@ -218,15 +218,15 @@ func (nsr *NamespaceResolver) LeaveNode(n ast.Vertex) {
|
||||
// AddAlias adds a new alias
|
||||
func (nsr *NamespaceResolver) AddAlias(useType string, nn ast.Vertex, prefix []ast.Vertex) {
|
||||
switch use := nn.(type) {
|
||||
case *ast.StmtUseDeclaration:
|
||||
case *ast.StmtUse:
|
||||
if use.Type != nil {
|
||||
useType = string(use.Type.(*ast.Identifier).Value)
|
||||
}
|
||||
|
||||
useNameParts := use.Use.(*ast.NameName).Parts
|
||||
useNameParts := use.Use.(*ast.Name).Parts
|
||||
var alias string
|
||||
if use.Alias == nil {
|
||||
alias = string(useNameParts[len(useNameParts)-1].(*ast.NameNamePart).Value)
|
||||
alias = string(useNameParts[len(useNameParts)-1].(*ast.NamePart).Value)
|
||||
} else {
|
||||
alias = string(use.Alias.(*ast.Identifier).Value)
|
||||
}
|
||||
@@ -257,7 +257,7 @@ func (nsr *NamespaceResolver) ResolveType(n ast.Vertex) {
|
||||
switch nn := n.(type) {
|
||||
case *ast.Nullable:
|
||||
nsr.ResolveType(nn.Expr)
|
||||
case *ast.NameName:
|
||||
case *ast.Name:
|
||||
nsr.ResolveName(n, "")
|
||||
case *ast.NameRelative:
|
||||
nsr.ResolveName(n, "")
|
||||
@@ -308,16 +308,16 @@ func (ns *Namespace) ResolveName(nameNode ast.Vertex, aliasType string) (string,
|
||||
}
|
||||
return ns.Namespace + "\\" + concatNameParts(n.Parts), nil
|
||||
|
||||
case *ast.NameName:
|
||||
case *ast.Name:
|
||||
if aliasType == "const" && len(n.Parts) == 1 {
|
||||
part := strings.ToLower(string(n.Parts[0].(*ast.NameNamePart).Value))
|
||||
part := strings.ToLower(string(n.Parts[0].(*ast.NamePart).Value))
|
||||
if part == "true" || part == "false" || part == "null" {
|
||||
return part, nil
|
||||
}
|
||||
}
|
||||
|
||||
if aliasType == "" && len(n.Parts) == 1 {
|
||||
part := strings.ToLower(string(n.Parts[0].(*ast.NameNamePart).Value))
|
||||
part := strings.ToLower(string(n.Parts[0].(*ast.NamePart).Value))
|
||||
|
||||
switch part {
|
||||
case "self":
|
||||
@@ -366,9 +366,9 @@ func (ns *Namespace) ResolveName(nameNode ast.Vertex, aliasType string) (string,
|
||||
// ResolveAlias returns alias or error if not found
|
||||
func (ns *Namespace) ResolveAlias(nameNode ast.Vertex, aliasType string) (string, error) {
|
||||
aliasType = strings.ToLower(aliasType)
|
||||
nameParts := nameNode.(*ast.NameName).Parts
|
||||
nameParts := nameNode.(*ast.Name).Parts
|
||||
|
||||
firstPartStr := string(nameParts[0].(*ast.NameNamePart).Value)
|
||||
firstPartStr := string(nameParts[0].(*ast.NamePart).Value)
|
||||
|
||||
if len(nameParts) > 1 { // resolve aliases for qualified names, always against class alias type
|
||||
firstPartStr = strings.ToLower(firstPartStr)
|
||||
@@ -393,9 +393,9 @@ func concatNameParts(parts ...[]ast.Vertex) string {
|
||||
for _, p := range parts {
|
||||
for _, n := range p {
|
||||
if str == "" {
|
||||
str = string(n.(*ast.NameNamePart).Value)
|
||||
str = string(n.(*ast.NamePart).Value)
|
||||
} else {
|
||||
str = str + "\\" + string(n.(*ast.NameNamePart).Value)
|
||||
str = str + "\\" + string(n.(*ast.NamePart).Value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,14 +11,14 @@ import (
|
||||
)
|
||||
|
||||
func TestResolveStaticCall(t *testing.T) {
|
||||
nameAB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}, &ast.NameNamePart{Value: []byte("C")}}}
|
||||
nameAB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}, &ast.NamePart{Value: []byte("C")}}}
|
||||
|
||||
stxTree := &ast.StmtStmtList{
|
||||
Stmts: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
UseDeclarations: []ast.Vertex{
|
||||
&ast.StmtUseDeclaration{
|
||||
&ast.StmtUseList{
|
||||
Uses: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
Use: nameAB,
|
||||
},
|
||||
},
|
||||
@@ -41,21 +41,21 @@ func TestResolveStaticCall(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResolveStaticPropertyFetch(t *testing.T) {
|
||||
nameAB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}, &ast.NameNamePart{Value: []byte("C")}}}
|
||||
nameAB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}, &ast.NamePart{Value: []byte("C")}}}
|
||||
|
||||
stxTree := &ast.StmtStmtList{
|
||||
Stmts: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
UseDeclarations: []ast.Vertex{
|
||||
&ast.StmtUseDeclaration{
|
||||
&ast.StmtUseList{
|
||||
Uses: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
Use: nameAB,
|
||||
},
|
||||
},
|
||||
},
|
||||
&ast.ExprStaticPropertyFetch{
|
||||
Class: nameBC,
|
||||
Property: &ast.Identifier{Value: []byte("foo")},
|
||||
Class: nameBC,
|
||||
Prop: &ast.Identifier{Value: []byte("foo")},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -71,21 +71,21 @@ func TestResolveStaticPropertyFetch(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResolveClassConstFetch(t *testing.T) {
|
||||
nameAB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}, &ast.NameNamePart{Value: []byte("C")}}}
|
||||
nameAB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}, &ast.NamePart{Value: []byte("C")}}}
|
||||
|
||||
stxTree := &ast.StmtStmtList{
|
||||
Stmts: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
UseDeclarations: []ast.Vertex{
|
||||
&ast.StmtUseDeclaration{
|
||||
&ast.StmtUseList{
|
||||
Uses: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
Use: nameAB,
|
||||
},
|
||||
},
|
||||
},
|
||||
&ast.ExprClassConstFetch{
|
||||
Class: nameBC,
|
||||
ConstantName: &ast.Identifier{Value: []byte("FOO")},
|
||||
Class: nameBC,
|
||||
Const: &ast.Identifier{Value: []byte("FOO")},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -101,14 +101,14 @@ func TestResolveClassConstFetch(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResolveNew(t *testing.T) {
|
||||
nameAB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}, &ast.NameNamePart{Value: []byte("C")}}}
|
||||
nameAB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}, &ast.NamePart{Value: []byte("C")}}}
|
||||
|
||||
stxTree := &ast.StmtStmtList{
|
||||
Stmts: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
UseDeclarations: []ast.Vertex{
|
||||
&ast.StmtUseDeclaration{
|
||||
&ast.StmtUseList{
|
||||
Uses: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
Use: nameAB,
|
||||
},
|
||||
},
|
||||
@@ -130,20 +130,20 @@ func TestResolveNew(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResolveInstanceOf(t *testing.T) {
|
||||
nameAB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}, &ast.NameNamePart{Value: []byte("C")}}}
|
||||
nameAB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}, &ast.NamePart{Value: []byte("C")}}}
|
||||
|
||||
stxTree := &ast.StmtStmtList{
|
||||
Stmts: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
UseDeclarations: []ast.Vertex{
|
||||
&ast.StmtUseDeclaration{
|
||||
&ast.StmtUseList{
|
||||
Uses: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
Use: nameAB,
|
||||
},
|
||||
},
|
||||
},
|
||||
&ast.ExprInstanceOf{
|
||||
Expr: &ast.ExprVariable{VarName: &ast.Identifier{Value: []byte("foo")}},
|
||||
Expr: &ast.ExprVariable{Name: &ast.Identifier{Value: []byte("foo")}},
|
||||
Class: nameBC,
|
||||
},
|
||||
},
|
||||
@@ -160,20 +160,20 @@ func TestResolveInstanceOf(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResolveInstanceCatch(t *testing.T) {
|
||||
nameAB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}, &ast.NameNamePart{Value: []byte("C")}}}
|
||||
nameAB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}, &ast.NamePart{Value: []byte("C")}}}
|
||||
|
||||
nameDE := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("D")}, &ast.NameNamePart{Value: []byte("E")}}}
|
||||
nameF := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("F")}}}
|
||||
nameDE := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("D")}, &ast.NamePart{Value: []byte("E")}}}
|
||||
nameF := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("F")}}}
|
||||
|
||||
stxTree := &ast.StmtStmtList{
|
||||
Stmts: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
UseDeclarations: []ast.Vertex{
|
||||
&ast.StmtUseDeclaration{
|
||||
&ast.StmtUseList{
|
||||
Uses: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
Use: nameAB,
|
||||
},
|
||||
&ast.StmtUseDeclaration{
|
||||
&ast.StmtUse{
|
||||
Use: nameDE,
|
||||
Alias: &ast.Identifier{Value: []byte("F")},
|
||||
},
|
||||
@@ -187,7 +187,7 @@ func TestResolveInstanceCatch(t *testing.T) {
|
||||
nameBC,
|
||||
nameF,
|
||||
},
|
||||
Var: &ast.ExprVariable{VarName: &ast.Identifier{Value: []byte("foo")}},
|
||||
Var: &ast.ExprVariable{Name: &ast.Identifier{Value: []byte("foo")}},
|
||||
Stmts: []ast.Vertex{},
|
||||
},
|
||||
},
|
||||
@@ -207,15 +207,15 @@ func TestResolveInstanceCatch(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResolveFunctionCall(t *testing.T) {
|
||||
nameAB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameAB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
nameB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}}}
|
||||
|
||||
stxTree := &ast.StmtStmtList{
|
||||
Stmts: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
&ast.StmtUseList{
|
||||
Type: &ast.Identifier{Value: []byte("function")},
|
||||
UseDeclarations: []ast.Vertex{
|
||||
&ast.StmtUseDeclaration{
|
||||
Uses: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
Use: nameAB,
|
||||
},
|
||||
},
|
||||
@@ -237,15 +237,15 @@ func TestResolveFunctionCall(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResolveConstFetch(t *testing.T) {
|
||||
nameAB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameAB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
nameB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}}}
|
||||
|
||||
stxTree := &ast.StmtStmtList{
|
||||
Stmts: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
&ast.StmtUseList{
|
||||
Type: &ast.Identifier{Value: []byte("const")},
|
||||
UseDeclarations: []ast.Vertex{
|
||||
&ast.StmtUseDeclaration{
|
||||
Uses: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
Use: nameAB,
|
||||
},
|
||||
},
|
||||
@@ -267,32 +267,32 @@ func TestResolveConstFetch(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResolveGroupUse(t *testing.T) {
|
||||
nameAB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameBD := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}, &ast.NameNamePart{Value: []byte("D")}}}
|
||||
nameE := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("E")}}}
|
||||
nameC := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("C")}}}
|
||||
nameF := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("F")}}}
|
||||
nameAB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
nameBD := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}, &ast.NamePart{Value: []byte("D")}}}
|
||||
nameE := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("E")}}}
|
||||
nameC := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("C")}}}
|
||||
nameF := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("F")}}}
|
||||
|
||||
stxTree := &ast.StmtStmtList{
|
||||
Stmts: []ast.Vertex{
|
||||
&ast.StmtGroupUse{
|
||||
&ast.StmtGroupUseList{
|
||||
Prefix: nameAB,
|
||||
UseDeclarations: []ast.Vertex{
|
||||
&ast.StmtUseDeclaration{
|
||||
Uses: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
Type: &ast.Identifier{Value: []byte("Function")},
|
||||
Use: nameF,
|
||||
},
|
||||
&ast.StmtUseDeclaration{
|
||||
&ast.StmtUse{
|
||||
Type: &ast.Identifier{Value: []byte("const")},
|
||||
Use: nameC,
|
||||
},
|
||||
},
|
||||
},
|
||||
&ast.StmtGroupUse{
|
||||
&ast.StmtGroupUseList{
|
||||
Prefix: nameBD,
|
||||
Type: &ast.Identifier{Value: []byte("Function")},
|
||||
UseDeclarations: []ast.Vertex{
|
||||
&ast.StmtUseDeclaration{
|
||||
Uses: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
Use: nameE,
|
||||
},
|
||||
},
|
||||
@@ -322,20 +322,20 @@ func TestResolveGroupUse(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResolveTraitUse(t *testing.T) {
|
||||
nameAB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameD := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("D")}}}
|
||||
nameAB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
nameB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}}}
|
||||
nameD := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("D")}}}
|
||||
|
||||
fullyQualifiedNameB := &ast.NameFullyQualified{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}}}
|
||||
fullyQualifiedNameBC := &ast.NameFullyQualified{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}, &ast.NameNamePart{Value: []byte("C")}}}
|
||||
relativeNameB := &ast.NameRelative{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}}}
|
||||
relativeNameBC := &ast.NameRelative{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}, &ast.NameNamePart{Value: []byte("C")}}}
|
||||
fullyQualifiedNameB := &ast.NameFullyQualified{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}}}
|
||||
fullyQualifiedNameBC := &ast.NameFullyQualified{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}, &ast.NamePart{Value: []byte("C")}}}
|
||||
relativeNameB := &ast.NameRelative{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}}}
|
||||
relativeNameBC := &ast.NameRelative{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}, &ast.NamePart{Value: []byte("C")}}}
|
||||
|
||||
stxTree := &ast.StmtStmtList{
|
||||
Stmts: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
UseDeclarations: []ast.Vertex{
|
||||
&ast.StmtUseDeclaration{
|
||||
&ast.StmtUseList{
|
||||
Uses: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
Use: nameAB,
|
||||
},
|
||||
},
|
||||
@@ -382,12 +382,12 @@ func TestResolveTraitUse(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResolveClassName(t *testing.T) {
|
||||
nameAB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}, &ast.NameNamePart{Value: []byte("C")}}}
|
||||
nameAB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}, &ast.NamePart{Value: []byte("C")}}}
|
||||
|
||||
class := &ast.StmtClass{
|
||||
ClassName: &ast.Identifier{Value: []byte("A")},
|
||||
Extends: nameAB,
|
||||
Name: &ast.Identifier{Value: []byte("A")},
|
||||
Extends: nameAB,
|
||||
Implements: []ast.Vertex{
|
||||
nameBC,
|
||||
},
|
||||
@@ -412,11 +412,11 @@ func TestResolveClassName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResolveInterfaceName(t *testing.T) {
|
||||
nameAB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}, &ast.NameNamePart{Value: []byte("C")}}}
|
||||
nameAB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}, &ast.NamePart{Value: []byte("C")}}}
|
||||
|
||||
interfaceNode := &ast.StmtInterface{
|
||||
InterfaceName: &ast.Identifier{Value: []byte("A")},
|
||||
Name: &ast.Identifier{Value: []byte("A")},
|
||||
Extends: []ast.Vertex{
|
||||
nameAB,
|
||||
nameBC,
|
||||
@@ -443,8 +443,8 @@ func TestResolveInterfaceName(t *testing.T) {
|
||||
|
||||
func TestResolveTraitName(t *testing.T) {
|
||||
traitNode := &ast.StmtTrait{
|
||||
TraitName: &ast.Identifier{Value: []byte("A")},
|
||||
Stmts: []ast.Vertex{},
|
||||
Name: &ast.Identifier{Value: []byte("A")},
|
||||
Stmts: []ast.Vertex{},
|
||||
}
|
||||
|
||||
stxTree := &ast.StmtStmtList{
|
||||
@@ -464,15 +464,15 @@ func TestResolveTraitName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResolveFunctionName(t *testing.T) {
|
||||
nameAB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}, &ast.NameNamePart{Value: []byte("C")}}}
|
||||
nameAB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}, &ast.NamePart{Value: []byte("C")}}}
|
||||
|
||||
functionNode := &ast.StmtFunction{
|
||||
FunctionName: &ast.Identifier{Value: []byte("A")},
|
||||
Name: &ast.Identifier{Value: []byte("A")},
|
||||
Params: []ast.Vertex{
|
||||
&ast.Parameter{
|
||||
Type: nameAB,
|
||||
Var: &ast.ExprVariable{VarName: &ast.Identifier{Value: []byte("foo")}},
|
||||
Var: &ast.ExprVariable{Name: &ast.Identifier{Value: []byte("foo")}},
|
||||
},
|
||||
},
|
||||
ReturnType: &ast.Nullable{Expr: nameBC},
|
||||
@@ -498,15 +498,15 @@ func TestResolveFunctionName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResolveMethodName(t *testing.T) {
|
||||
nameAB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}, &ast.NameNamePart{Value: []byte("C")}}}
|
||||
nameAB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}, &ast.NamePart{Value: []byte("C")}}}
|
||||
|
||||
methodNode := &ast.StmtClassMethod{
|
||||
MethodName: &ast.Identifier{Value: []byte("A")},
|
||||
Name: &ast.Identifier{Value: []byte("A")},
|
||||
Params: []ast.Vertex{
|
||||
&ast.Parameter{
|
||||
Type: nameAB,
|
||||
Var: &ast.ExprVariable{VarName: &ast.Identifier{Value: []byte("foo")}},
|
||||
Var: &ast.ExprVariable{Name: &ast.Identifier{Value: []byte("foo")}},
|
||||
},
|
||||
},
|
||||
ReturnType: &ast.Nullable{Expr: nameBC},
|
||||
@@ -527,14 +527,14 @@ func TestResolveMethodName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResolveClosureName(t *testing.T) {
|
||||
nameAB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("B")}, &ast.NameNamePart{Value: []byte("C")}}}
|
||||
nameAB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
nameBC := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}, &ast.NamePart{Value: []byte("C")}}}
|
||||
|
||||
closureNode := &ast.ExprClosure{
|
||||
Params: []ast.Vertex{
|
||||
&ast.Parameter{
|
||||
Type: nameAB,
|
||||
Var: &ast.ExprVariable{VarName: &ast.Identifier{Value: []byte("foo")}},
|
||||
Var: &ast.ExprVariable{Name: &ast.Identifier{Value: []byte("foo")}},
|
||||
},
|
||||
},
|
||||
ReturnType: &ast.Nullable{Expr: nameBC},
|
||||
@@ -553,7 +553,7 @@ func TestResolveClosureName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResolveConstantsName(t *testing.T) {
|
||||
nameAB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameAB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
|
||||
constantB := &ast.StmtConstant{
|
||||
Name: &ast.Identifier{Value: []byte("B")},
|
||||
@@ -590,13 +590,13 @@ func TestResolveConstantsName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResolveNamespaces(t *testing.T) {
|
||||
namespaceAB := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
namespaceCD := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("C")}, &ast.NameNamePart{Value: []byte("D")}}}
|
||||
namespaceAB := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
namespaceCD := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("C")}, &ast.NamePart{Value: []byte("D")}}}
|
||||
|
||||
nameAC := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("C")}}}
|
||||
nameCF := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("C")}, &ast.NameNamePart{Value: []byte("F")}}}
|
||||
nameFG := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("F")}, &ast.NameNamePart{Value: []byte("G")}}}
|
||||
relativeNameCE := &ast.NameRelative{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("C")}, &ast.NameNamePart{Value: []byte("E")}}}
|
||||
nameAC := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("C")}}}
|
||||
nameCF := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("C")}, &ast.NamePart{Value: []byte("F")}}}
|
||||
nameFG := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("F")}, &ast.NamePart{Value: []byte("G")}}}
|
||||
relativeNameCE := &ast.NameRelative{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("C")}, &ast.NamePart{Value: []byte("E")}}}
|
||||
|
||||
constantB := &ast.StmtConstant{
|
||||
Name: &ast.Identifier{Value: []byte("B")},
|
||||
@@ -628,9 +628,9 @@ func TestResolveNamespaces(t *testing.T) {
|
||||
&ast.StmtNamespace{
|
||||
Name: namespaceCD,
|
||||
Stmts: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
UseDeclarations: []ast.Vertex{
|
||||
&ast.StmtUseDeclaration{
|
||||
&ast.StmtUseList{
|
||||
Uses: []ast.Vertex{
|
||||
&ast.StmtUse{
|
||||
Use: nameAC,
|
||||
},
|
||||
},
|
||||
@@ -666,7 +666,7 @@ func TestResolveStaticCallDinamicClassName(t *testing.T) {
|
||||
stxTree := &ast.StmtStmtList{
|
||||
Stmts: []ast.Vertex{
|
||||
&ast.ExprStaticCall{
|
||||
Class: &ast.ExprVariable{VarName: &ast.Identifier{Value: []byte("foo")}},
|
||||
Class: &ast.ExprVariable{Name: &ast.Identifier{Value: []byte("foo")}},
|
||||
Call: &ast.Identifier{Value: []byte("foo")},
|
||||
},
|
||||
},
|
||||
@@ -681,23 +681,23 @@ func TestResolveStaticCallDinamicClassName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDoNotResolveReservedConstants(t *testing.T) {
|
||||
namespaceName := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("Foo")}}}
|
||||
namespaceName := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("Foo")}}}
|
||||
|
||||
constantTrue := &ast.NameName{
|
||||
constantTrue := &ast.Name{
|
||||
Parts: []ast.Vertex{
|
||||
&ast.NameNamePart{Value: []byte("True")},
|
||||
&ast.NamePart{Value: []byte("True")},
|
||||
},
|
||||
}
|
||||
|
||||
constantFalse := &ast.NameName{
|
||||
constantFalse := &ast.Name{
|
||||
Parts: []ast.Vertex{
|
||||
&ast.NameNamePart{Value: []byte("False")},
|
||||
&ast.NamePart{Value: []byte("False")},
|
||||
},
|
||||
}
|
||||
|
||||
constantNull := &ast.NameName{
|
||||
constantNull := &ast.Name{
|
||||
Parts: []ast.Vertex{
|
||||
&ast.NameNamePart{Value: []byte("NULL")},
|
||||
&ast.NamePart{Value: []byte("NULL")},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -738,91 +738,91 @@ func TestDoNotResolveReservedConstants(t *testing.T) {
|
||||
|
||||
func TestDoNotResolveReservedNames(t *testing.T) {
|
||||
|
||||
nameInt := &ast.NameName{
|
||||
nameInt := &ast.Name{
|
||||
Parts: []ast.Vertex{
|
||||
&ast.NameNamePart{Value: []byte("int")},
|
||||
&ast.NamePart{Value: []byte("int")},
|
||||
},
|
||||
}
|
||||
|
||||
nameFloat := &ast.NameName{
|
||||
nameFloat := &ast.Name{
|
||||
Parts: []ast.Vertex{
|
||||
&ast.NameNamePart{Value: []byte("float")},
|
||||
&ast.NamePart{Value: []byte("float")},
|
||||
},
|
||||
}
|
||||
|
||||
nameBool := &ast.NameName{
|
||||
nameBool := &ast.Name{
|
||||
Parts: []ast.Vertex{
|
||||
&ast.NameNamePart{Value: []byte("bool")},
|
||||
&ast.NamePart{Value: []byte("bool")},
|
||||
},
|
||||
}
|
||||
|
||||
nameString := &ast.NameName{
|
||||
nameString := &ast.Name{
|
||||
Parts: []ast.Vertex{
|
||||
&ast.NameNamePart{Value: []byte("string")},
|
||||
&ast.NamePart{Value: []byte("string")},
|
||||
},
|
||||
}
|
||||
|
||||
nameVoid := &ast.NameName{
|
||||
nameVoid := &ast.Name{
|
||||
Parts: []ast.Vertex{
|
||||
&ast.NameNamePart{Value: []byte("void")},
|
||||
&ast.NamePart{Value: []byte("void")},
|
||||
},
|
||||
}
|
||||
|
||||
nameIterable := &ast.NameName{
|
||||
nameIterable := &ast.Name{
|
||||
Parts: []ast.Vertex{
|
||||
&ast.NameNamePart{Value: []byte("iterable")},
|
||||
&ast.NamePart{Value: []byte("iterable")},
|
||||
},
|
||||
}
|
||||
|
||||
nameObject := &ast.NameName{
|
||||
nameObject := &ast.Name{
|
||||
Parts: []ast.Vertex{
|
||||
&ast.NameNamePart{Value: []byte("object")},
|
||||
&ast.NamePart{Value: []byte("object")},
|
||||
},
|
||||
}
|
||||
|
||||
function := &ast.StmtFunction{
|
||||
FunctionName: &ast.Identifier{Value: []byte("bar")},
|
||||
Name: &ast.Identifier{Value: []byte("bar")},
|
||||
Params: []ast.Vertex{
|
||||
&ast.Parameter{
|
||||
Type: nameInt,
|
||||
Var: &ast.ExprVariable{
|
||||
VarName: &ast.Identifier{Value: []byte("Int")},
|
||||
Name: &ast.Identifier{Value: []byte("Int")},
|
||||
},
|
||||
},
|
||||
&ast.Parameter{
|
||||
Type: nameFloat,
|
||||
Var: &ast.ExprVariable{
|
||||
VarName: &ast.Identifier{Value: []byte("Float")},
|
||||
Name: &ast.Identifier{Value: []byte("Float")},
|
||||
},
|
||||
},
|
||||
&ast.Parameter{
|
||||
Type: nameBool,
|
||||
Var: &ast.ExprVariable{
|
||||
VarName: &ast.Identifier{Value: []byte("Bool")},
|
||||
Name: &ast.Identifier{Value: []byte("Bool")},
|
||||
},
|
||||
},
|
||||
&ast.Parameter{
|
||||
Type: nameString,
|
||||
Var: &ast.ExprVariable{
|
||||
VarName: &ast.Identifier{Value: []byte("String")},
|
||||
Name: &ast.Identifier{Value: []byte("String")},
|
||||
},
|
||||
},
|
||||
&ast.Parameter{
|
||||
Type: nameVoid,
|
||||
Var: &ast.ExprVariable{
|
||||
VarName: &ast.Identifier{Value: []byte("Void")},
|
||||
Name: &ast.Identifier{Value: []byte("Void")},
|
||||
},
|
||||
},
|
||||
&ast.Parameter{
|
||||
Type: nameIterable,
|
||||
Var: &ast.ExprVariable{
|
||||
VarName: &ast.Identifier{Value: []byte("Iterable")},
|
||||
Name: &ast.Identifier{Value: []byte("Iterable")},
|
||||
},
|
||||
},
|
||||
&ast.Parameter{
|
||||
Type: nameObject,
|
||||
Var: &ast.ExprVariable{
|
||||
VarName: &ast.Identifier{Value: []byte("Object")},
|
||||
Name: &ast.Identifier{Value: []byte("Object")},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -831,9 +831,9 @@ func TestDoNotResolveReservedNames(t *testing.T) {
|
||||
stxTree := &ast.StmtStmtList{
|
||||
Stmts: []ast.Vertex{
|
||||
&ast.StmtNamespace{
|
||||
Name: &ast.NameName{
|
||||
Name: &ast.Name{
|
||||
Parts: []ast.Vertex{
|
||||
&ast.NameNamePart{Value: []byte("Foo")},
|
||||
&ast.NamePart{Value: []byte("Foo")},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -860,26 +860,26 @@ func TestDoNotResolveReservedNames(t *testing.T) {
|
||||
|
||||
func TestDoNotResolveReservedSpecialNames(t *testing.T) {
|
||||
|
||||
nameSelf := &ast.NameName{
|
||||
nameSelf := &ast.Name{
|
||||
Parts: []ast.Vertex{
|
||||
&ast.NameNamePart{Value: []byte("Self")},
|
||||
&ast.NamePart{Value: []byte("Self")},
|
||||
},
|
||||
}
|
||||
|
||||
nameStatic := &ast.NameName{
|
||||
nameStatic := &ast.Name{
|
||||
Parts: []ast.Vertex{
|
||||
&ast.NameNamePart{Value: []byte("Static")},
|
||||
&ast.NamePart{Value: []byte("Static")},
|
||||
},
|
||||
}
|
||||
|
||||
nameParent := &ast.NameName{
|
||||
nameParent := &ast.Name{
|
||||
Parts: []ast.Vertex{
|
||||
&ast.NameNamePart{Value: []byte("Parent")},
|
||||
&ast.NamePart{Value: []byte("Parent")},
|
||||
},
|
||||
}
|
||||
|
||||
cls := &ast.StmtClass{
|
||||
ClassName: &ast.Identifier{Value: []byte("Bar")},
|
||||
Name: &ast.Identifier{Value: []byte("Bar")},
|
||||
Stmts: []ast.Vertex{
|
||||
&ast.StmtExpression{
|
||||
Expr: &ast.ExprStaticCall{
|
||||
@@ -905,9 +905,9 @@ func TestDoNotResolveReservedSpecialNames(t *testing.T) {
|
||||
stxTree := &ast.StmtStmtList{
|
||||
Stmts: []ast.Vertex{
|
||||
&ast.StmtNamespace{
|
||||
Name: &ast.NameName{
|
||||
Name: &ast.Name{
|
||||
Parts: []ast.Vertex{
|
||||
&ast.NameNamePart{Value: []byte("Foo")},
|
||||
&ast.NamePart{Value: []byte("Foo")},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -928,9 +928,9 @@ func TestDoNotResolveReservedSpecialNames(t *testing.T) {
|
||||
assert.DeepEqual(t, expected, nsResolver.ResolvedNames)
|
||||
}
|
||||
func TestResolvePropertyTypeName(t *testing.T) {
|
||||
nameSimple := &ast.NameName{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameRelative := &ast.NameRelative{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameFullyQualified := &ast.NameFullyQualified{Parts: []ast.Vertex{&ast.NameNamePart{Value: []byte("A")}, &ast.NameNamePart{Value: []byte("B")}}}
|
||||
nameSimple := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
nameRelative := &ast.NameRelative{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
nameFullyQualified := &ast.NameFullyQualified{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("A")}, &ast.NamePart{Value: []byte("B")}}}
|
||||
|
||||
propertyNodeSimple := &ast.StmtPropertyList{
|
||||
Type: nameSimple,
|
||||
@@ -945,7 +945,7 @@ func TestResolvePropertyTypeName(t *testing.T) {
|
||||
}
|
||||
|
||||
classNode := &ast.StmtClass{
|
||||
ClassName: &ast.Identifier{Value: []byte("Bar")},
|
||||
Name: &ast.Identifier{Value: []byte("Bar")},
|
||||
Stmts: []ast.Vertex{
|
||||
propertyNodeSimple,
|
||||
propertyNodeRelative,
|
||||
@@ -956,9 +956,9 @@ func TestResolvePropertyTypeName(t *testing.T) {
|
||||
stmts := &ast.StmtStmtList{
|
||||
Stmts: []ast.Vertex{
|
||||
&ast.StmtNamespace{
|
||||
Name: &ast.NameName{
|
||||
Name: &ast.Name{
|
||||
Parts: []ast.Vertex{
|
||||
&ast.NameNamePart{Value: []byte("Foo")},
|
||||
&ast.NamePart{Value: []byte("Foo")},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -214,15 +214,15 @@ func (v *Null) StmtUnset(_ *ast.StmtUnset) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
func (v *Null) StmtUse(_ *ast.StmtUse) {
|
||||
func (v *Null) StmtUse(_ *ast.StmtUseList) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
func (v *Null) StmtGroupUse(_ *ast.StmtGroupUse) {
|
||||
func (v *Null) StmtGroupUse(_ *ast.StmtGroupUseList) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
func (v *Null) StmtUseDeclaration(_ *ast.StmtUseDeclaration) {
|
||||
func (v *Null) StmtUseDeclaration(_ *ast.StmtUse) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@@ -626,7 +626,7 @@ func (v *Null) ScalarString(_ *ast.ScalarString) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
func (v *Null) NameName(_ *ast.NameName) {
|
||||
func (v *Null) NameName(_ *ast.Name) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@@ -638,6 +638,6 @@ func (v *Null) NameRelative(_ *ast.NameRelative) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
func (v *Null) NameNamePart(_ *ast.NameNamePart) {
|
||||
func (v *Null) NameNamePart(_ *ast.NamePart) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@@ -190,10 +190,10 @@ func (p *printer) StmtCatch(n *ast.StmtCatch) {
|
||||
func (p *printer) StmtClass(n *ast.StmtClass) {
|
||||
p.printList(n.Modifiers)
|
||||
p.printToken(n.ClassTkn, []byte("class"))
|
||||
p.printNode(n.ClassName)
|
||||
p.printToken(n.OpenParenthesisTkn, p.ifNodeList(n.Arguments, []byte("(")))
|
||||
p.printSeparatedList(n.Arguments, n.SeparatorTkns, []byte(","))
|
||||
p.printToken(n.CloseParenthesisTkn, p.ifNodeList(n.Arguments, []byte(")")))
|
||||
p.printNode(n.Name)
|
||||
p.printToken(n.OpenParenthesisTkn, p.ifNodeList(n.Args, []byte("(")))
|
||||
p.printSeparatedList(n.Args, n.SeparatorTkns, []byte(","))
|
||||
p.printToken(n.CloseParenthesisTkn, p.ifNodeList(n.Args, []byte(")")))
|
||||
p.printToken(n.ExtendsTkn, p.ifNode(n.Extends, []byte("extends")))
|
||||
p.printNode(n.Extends)
|
||||
p.printToken(n.ImplementsTkn, p.ifNodeList(n.Implements, []byte("implements")))
|
||||
@@ -214,7 +214,7 @@ func (p *printer) StmtClassMethod(n *ast.StmtClassMethod) {
|
||||
p.printList(n.Modifiers)
|
||||
p.printToken(n.FunctionTkn, []byte("function"))
|
||||
p.printToken(n.AmpersandTkn, nil)
|
||||
p.printNode(n.MethodName)
|
||||
p.printNode(n.Name)
|
||||
p.printToken(n.OpenParenthesisTkn, []byte("("))
|
||||
p.printSeparatedList(n.Params, n.SeparatorTkns, []byte(","))
|
||||
p.printToken(n.CloseParenthesisTkn, []byte(")"))
|
||||
@@ -366,7 +366,7 @@ func (p *printer) StmtForeach(n *ast.StmtForeach) {
|
||||
func (p *printer) StmtFunction(n *ast.StmtFunction) {
|
||||
p.printToken(n.FunctionTkn, []byte("function"))
|
||||
p.printToken(n.AmpersandTkn, nil)
|
||||
p.printNode(n.FunctionName)
|
||||
p.printNode(n.Name)
|
||||
p.printToken(n.OpenParenthesisTkn, []byte("("))
|
||||
p.printSeparatedList(n.Params, n.SeparatorTkns, []byte(","))
|
||||
p.printToken(n.CloseParenthesisTkn, []byte(")"))
|
||||
@@ -427,7 +427,7 @@ func (p *printer) StmtInlineHtml(n *ast.StmtInlineHtml) {
|
||||
|
||||
func (p *printer) StmtInterface(n *ast.StmtInterface) {
|
||||
p.printToken(n.InterfaceTkn, []byte("interface"))
|
||||
p.printNode(n.InterfaceName)
|
||||
p.printNode(n.Name)
|
||||
p.printToken(n.ExtendsTkn, p.ifNodeList(n.Extends, []byte("extends")))
|
||||
p.printSeparatedList(n.Extends, n.ExtendsSeparatorTkns, []byte(","))
|
||||
p.printToken(n.OpenCurlyBracketTkn, []byte("{"))
|
||||
@@ -436,7 +436,7 @@ func (p *printer) StmtInterface(n *ast.StmtInterface) {
|
||||
}
|
||||
|
||||
func (p *printer) StmtLabel(n *ast.StmtLabel) {
|
||||
p.printNode(n.LabelName)
|
||||
p.printNode(n.Name)
|
||||
p.printToken(n.ColonTkn, []byte(":"))
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ func (p *printer) StmtProperty(n *ast.StmtProperty) {
|
||||
func (p *printer) StmtPropertyList(n *ast.StmtPropertyList) {
|
||||
p.printList(n.Modifiers)
|
||||
p.printNode(n.Type)
|
||||
p.printSeparatedList(n.Properties, n.SeparatorTkns, []byte(","))
|
||||
p.printSeparatedList(n.Props, n.SeparatorTkns, []byte(","))
|
||||
p.printToken(n.SemiColonTkn, []byte(";"))
|
||||
}
|
||||
|
||||
@@ -498,7 +498,7 @@ func (p *printer) StmtSwitch(n *ast.StmtSwitch) {
|
||||
p.printToken(n.ColonTkn, nil)
|
||||
p.printToken(n.OpenCurlyBracketTkn, p.ifNotToken(n.ColonTkn, []byte("{")))
|
||||
p.printToken(n.CaseSeparatorTkn, nil)
|
||||
p.printList(n.CaseList)
|
||||
p.printList(n.Cases)
|
||||
p.printToken(n.CloseCurlyBracketTkn, p.ifNotToken(n.ColonTkn, []byte("}")))
|
||||
p.printToken(n.EndSwitchTkn, p.ifToken(n.ColonTkn, []byte("endswitch"), nil))
|
||||
p.printToken(n.SemiColonTkn, p.ifToken(n.ColonTkn, []byte(";"), nil))
|
||||
@@ -512,7 +512,7 @@ func (p *printer) StmtThrow(n *ast.StmtThrow) {
|
||||
|
||||
func (p *printer) StmtTrait(n *ast.StmtTrait) {
|
||||
p.printToken(n.TraitTkn, []byte("trait"))
|
||||
p.printNode(n.TraitName)
|
||||
p.printNode(n.Name)
|
||||
p.printToken(n.OpenCurlyBracketTkn, []byte("{"))
|
||||
p.printList(n.Stmts)
|
||||
p.printToken(n.CloseCurlyBracketTkn, []byte("}"))
|
||||
@@ -563,26 +563,26 @@ func (p *printer) StmtUnset(n *ast.StmtUnset) {
|
||||
p.printToken(n.SemiColonTkn, []byte(";"))
|
||||
}
|
||||
|
||||
func (p *printer) StmtUse(n *ast.StmtUse) {
|
||||
func (p *printer) StmtUse(n *ast.StmtUseList) {
|
||||
p.printToken(n.UseTkn, []byte("use"))
|
||||
p.printNode(n.Type)
|
||||
p.printSeparatedList(n.UseDeclarations, n.SeparatorTkns, []byte(","))
|
||||
p.printSeparatedList(n.Uses, n.SeparatorTkns, []byte(","))
|
||||
p.printToken(n.SemiColonTkn, []byte(";"))
|
||||
}
|
||||
|
||||
func (p *printer) StmtGroupUse(n *ast.StmtGroupUse) {
|
||||
func (p *printer) StmtGroupUse(n *ast.StmtGroupUseList) {
|
||||
p.printToken(n.UseTkn, []byte("use"))
|
||||
p.printNode(n.Type)
|
||||
p.printToken(n.LeadingNsSeparatorTkn, nil)
|
||||
p.printNode(n.Prefix)
|
||||
p.printToken(n.NsSeparatorTkn, []byte("\\"))
|
||||
p.printToken(n.OpenCurlyBracketTkn, []byte("{"))
|
||||
p.printSeparatedList(n.UseDeclarations, n.SeparatorTkns, []byte(","))
|
||||
p.printSeparatedList(n.Uses, n.SeparatorTkns, []byte(","))
|
||||
p.printToken(n.CloseCurlyBracketTkn, []byte("}"))
|
||||
p.printToken(n.SemiColonTkn, []byte(";"))
|
||||
}
|
||||
|
||||
func (p *printer) StmtUseDeclaration(n *ast.StmtUseDeclaration) {
|
||||
func (p *printer) StmtUseDeclaration(n *ast.StmtUse) {
|
||||
p.printNode(n.Type)
|
||||
p.printToken(n.NsSeparatorTkn, nil)
|
||||
p.printNode(n.Use)
|
||||
@@ -661,7 +661,7 @@ func (p *printer) ExprBrackets(n *ast.ExprBrackets) {
|
||||
func (p *printer) ExprClassConstFetch(n *ast.ExprClassConstFetch) {
|
||||
p.printNode(n.Class)
|
||||
p.printToken(n.DoubleColonTkn, []byte("::"))
|
||||
p.printNode(n.ConstantName)
|
||||
p.printNode(n.Const)
|
||||
}
|
||||
|
||||
func (p *printer) ExprClone(n *ast.ExprClone) {
|
||||
@@ -676,10 +676,10 @@ func (p *printer) ExprClosure(n *ast.ExprClosure) {
|
||||
p.printToken(n.OpenParenthesisTkn, []byte("("))
|
||||
p.printSeparatedList(n.Params, n.SeparatorTkns, []byte(","))
|
||||
p.printToken(n.CloseParenthesisTkn, []byte(")"))
|
||||
p.printToken(n.UseTkn, p.ifNodeList(n.Use, []byte("use")))
|
||||
p.printToken(n.UseOpenParenthesisTkn, p.ifNodeList(n.Use, []byte("(")))
|
||||
p.printSeparatedList(n.Use, n.UseSeparatorTkns, []byte(","))
|
||||
p.printToken(n.UseCloseParenthesisTkn, p.ifNodeList(n.Use, []byte(")")))
|
||||
p.printToken(n.UseTkn, p.ifNodeList(n.Uses, []byte("use")))
|
||||
p.printToken(n.UseOpenParenthesisTkn, p.ifNodeList(n.Uses, []byte("(")))
|
||||
p.printSeparatedList(n.Uses, n.UseSeparatorTkns, []byte(","))
|
||||
p.printToken(n.UseCloseParenthesisTkn, p.ifNodeList(n.Uses, []byte(")")))
|
||||
p.printToken(n.ColonTkn, p.ifNode(n.ReturnType, []byte(":")))
|
||||
p.printNode(n.ReturnType)
|
||||
p.printToken(n.OpenCurlyBracketTkn, []byte("{"))
|
||||
@@ -725,7 +725,7 @@ func (p *printer) ExprExit(n *ast.ExprExit) {
|
||||
func (p *printer) ExprFunctionCall(n *ast.ExprFunctionCall) {
|
||||
p.printNode(n.Function)
|
||||
p.printToken(n.OpenParenthesisTkn, []byte("("))
|
||||
p.printSeparatedList(n.Arguments, n.SeparatorTkns, []byte(","))
|
||||
p.printSeparatedList(n.Args, n.SeparatorTkns, []byte(","))
|
||||
p.printToken(n.CloseParenthesisTkn, []byte(")"))
|
||||
}
|
||||
|
||||
@@ -766,16 +766,16 @@ func (p *printer) ExprMethodCall(n *ast.ExprMethodCall) {
|
||||
p.printNode(n.Method)
|
||||
p.printToken(n.CloseCurlyBracketTkn, nil)
|
||||
p.printToken(n.OpenParenthesisTkn, []byte("("))
|
||||
p.printSeparatedList(n.Arguments, n.SeparatorTkns, []byte(","))
|
||||
p.printSeparatedList(n.Args, n.SeparatorTkns, []byte(","))
|
||||
p.printToken(n.CloseParenthesisTkn, []byte(")"))
|
||||
}
|
||||
|
||||
func (p *printer) ExprNew(n *ast.ExprNew) {
|
||||
p.printToken(n.NewTkn, []byte("new"))
|
||||
p.printNode(n.Class)
|
||||
p.printToken(n.OpenParenthesisTkn, p.ifNodeList(n.Arguments, []byte("(")))
|
||||
p.printSeparatedList(n.Arguments, n.SeparatorTkns, []byte(","))
|
||||
p.printToken(n.CloseParenthesisTkn, p.ifNodeList(n.Arguments, []byte(")")))
|
||||
p.printToken(n.OpenParenthesisTkn, p.ifNodeList(n.Args, []byte("(")))
|
||||
p.printSeparatedList(n.Args, n.SeparatorTkns, []byte(","))
|
||||
p.printToken(n.CloseParenthesisTkn, p.ifNodeList(n.Args, []byte(")")))
|
||||
}
|
||||
|
||||
func (p *printer) ExprPostDec(n *ast.ExprPostDec) {
|
||||
@@ -807,7 +807,7 @@ func (p *printer) ExprPropertyFetch(n *ast.ExprPropertyFetch) {
|
||||
p.printNode(n.Var)
|
||||
p.printToken(n.ObjectOperatorTkn, []byte("->"))
|
||||
p.printToken(n.OpenCurlyBracketTkn, nil)
|
||||
p.printNode(n.Property)
|
||||
p.printNode(n.Prop)
|
||||
p.printToken(n.CloseCurlyBracketTkn, nil)
|
||||
}
|
||||
|
||||
@@ -833,19 +833,19 @@ func (p *printer) ExprStaticCall(n *ast.ExprStaticCall) {
|
||||
p.printToken(n.OpenCurlyBracketTkn, nil)
|
||||
p.printNode(n.Call)
|
||||
p.printToken(n.CloseCurlyBracketTkn, nil)
|
||||
p.printToken(n.OpenParenthesisTkn, p.ifNodeList(n.Arguments, []byte("(")))
|
||||
p.printSeparatedList(n.Arguments, n.SeparatorTkns, []byte(","))
|
||||
p.printToken(n.CloseParenthesisTkn, p.ifNodeList(n.Arguments, []byte(")")))
|
||||
p.printToken(n.OpenParenthesisTkn, p.ifNodeList(n.Args, []byte("(")))
|
||||
p.printSeparatedList(n.Args, n.SeparatorTkns, []byte(","))
|
||||
p.printToken(n.CloseParenthesisTkn, p.ifNodeList(n.Args, []byte(")")))
|
||||
}
|
||||
|
||||
func (p *printer) ExprStaticPropertyFetch(n *ast.ExprStaticPropertyFetch) {
|
||||
p.printNode(n.Class)
|
||||
p.printToken(n.DoubleColonTkn, []byte("::"))
|
||||
p.printNode(n.Property)
|
||||
p.printNode(n.Prop)
|
||||
}
|
||||
|
||||
func (p *printer) ExprTernary(n *ast.ExprTernary) {
|
||||
p.printNode(n.Condition)
|
||||
p.printNode(n.Cond)
|
||||
p.printToken(n.QuestionTkn, []byte("?"))
|
||||
p.printNode(n.IfTrue)
|
||||
p.printToken(n.ColonTkn, []byte(":"))
|
||||
@@ -865,7 +865,7 @@ func (p *printer) ExprUnaryPlus(n *ast.ExprUnaryPlus) {
|
||||
func (p *printer) ExprVariable(n *ast.ExprVariable) {
|
||||
p.printToken(n.DollarTkn, nil)
|
||||
p.printToken(n.OpenCurlyBracketTkn, nil)
|
||||
p.printNode(n.VarName)
|
||||
p.printNode(n.Name)
|
||||
p.printToken(n.CloseCurlyBracketTkn, nil)
|
||||
}
|
||||
|
||||
@@ -873,7 +873,7 @@ func (p *printer) ExprYield(n *ast.ExprYield) {
|
||||
p.printToken(n.YieldTkn, []byte("yield"))
|
||||
p.printNode(n.Key)
|
||||
p.printToken(n.DoubleArrowTkn, p.ifNode(n.Key, []byte("=>")))
|
||||
p.printNode(n.Value)
|
||||
p.printNode(n.Val)
|
||||
}
|
||||
|
||||
func (p *printer) ExprYieldFrom(n *ast.ExprYieldFrom) {
|
||||
@@ -1185,7 +1185,7 @@ func (p *printer) ScalarEncapsedStringPart(n *ast.ScalarEncapsedStringPart) {
|
||||
|
||||
func (p *printer) ScalarEncapsedStringVar(n *ast.ScalarEncapsedStringVar) {
|
||||
p.printToken(n.DollarOpenCurlyBracketTkn, []byte("${"))
|
||||
p.printNode(n.VarName)
|
||||
p.printNode(n.Name)
|
||||
p.printToken(n.OpenSquareBracketTkn, p.ifNode(n.Dim, []byte("[")))
|
||||
p.printNode(n.Dim)
|
||||
p.printToken(n.CloseSquareBracketTkn, p.ifNode(n.Dim, []byte("]")))
|
||||
@@ -1217,7 +1217,7 @@ func (p *printer) ScalarString(n *ast.ScalarString) {
|
||||
p.printToken(n.StringTkn, n.Value)
|
||||
}
|
||||
|
||||
func (p *printer) NameName(n *ast.NameName) {
|
||||
func (p *printer) NameName(n *ast.Name) {
|
||||
p.printSeparatedList(n.Parts, n.SeparatorTkns, []byte("\\"))
|
||||
}
|
||||
|
||||
@@ -1232,6 +1232,6 @@ func (p *printer) NameRelative(n *ast.NameRelative) {
|
||||
p.printSeparatedList(n.Parts, n.SeparatorTkns, []byte("\\"))
|
||||
}
|
||||
|
||||
func (p *printer) NameNamePart(n *ast.NameNamePart) {
|
||||
func (p *printer) NameNamePart(n *ast.NamePart) {
|
||||
p.printToken(n.StringTkn, n.Value)
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ abstract class Bar extends Baz
|
||||
|
||||
// change namespace
|
||||
|
||||
parts := &rootNode.(*ast.Root).Stmts[0].(*ast.StmtNamespace).Name.(*ast.NameName).Parts
|
||||
*parts = append(*parts, &ast.NameNamePart{Value: []byte("Quuz")})
|
||||
parts := &rootNode.(*ast.Root).Stmts[0].(*ast.StmtNamespace).Name.(*ast.Name).Parts
|
||||
*parts = append(*parts, &ast.NamePart{Value: []byte("Quuz")})
|
||||
|
||||
// print
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -85,8 +85,8 @@ func (t *Traverser) StmtClass(n *ast.StmtClass) {
|
||||
for _, nn := range n.Modifiers {
|
||||
nn.Accept(t)
|
||||
}
|
||||
t.Traverse(n.ClassName)
|
||||
for _, nn := range n.Arguments {
|
||||
t.Traverse(n.Name)
|
||||
for _, nn := range n.Args {
|
||||
nn.Accept(t)
|
||||
}
|
||||
t.Traverse(n.Extends)
|
||||
@@ -115,7 +115,7 @@ func (t *Traverser) StmtClassMethod(n *ast.StmtClassMethod) {
|
||||
for _, nn := range n.Modifiers {
|
||||
nn.Accept(t)
|
||||
}
|
||||
t.Traverse(n.MethodName)
|
||||
t.Traverse(n.Name)
|
||||
for _, nn := range n.Params {
|
||||
nn.Accept(t)
|
||||
}
|
||||
@@ -230,7 +230,7 @@ func (t *Traverser) StmtForeach(n *ast.StmtForeach) {
|
||||
func (t *Traverser) StmtFunction(n *ast.StmtFunction) {
|
||||
n.Accept(t.v)
|
||||
|
||||
t.Traverse(n.FunctionName)
|
||||
t.Traverse(n.Name)
|
||||
for _, nn := range n.Params {
|
||||
nn.Accept(t)
|
||||
}
|
||||
@@ -276,7 +276,7 @@ func (t *Traverser) StmtInlineHtml(n *ast.StmtInlineHtml) {
|
||||
func (t *Traverser) StmtInterface(n *ast.StmtInterface) {
|
||||
n.Accept(t.v)
|
||||
|
||||
t.Traverse(n.InterfaceName)
|
||||
t.Traverse(n.Name)
|
||||
for _, nn := range n.Extends {
|
||||
nn.Accept(t)
|
||||
}
|
||||
@@ -288,7 +288,7 @@ func (t *Traverser) StmtInterface(n *ast.StmtInterface) {
|
||||
func (t *Traverser) StmtLabel(n *ast.StmtLabel) {
|
||||
n.Accept(t.v)
|
||||
|
||||
t.Traverse(n.LabelName)
|
||||
t.Traverse(n.Name)
|
||||
}
|
||||
|
||||
func (t *Traverser) StmtNamespace(n *ast.StmtNamespace) {
|
||||
@@ -318,7 +318,7 @@ func (t *Traverser) StmtPropertyList(n *ast.StmtPropertyList) {
|
||||
nn.Accept(t)
|
||||
}
|
||||
t.Traverse(n.Type)
|
||||
for _, nn := range n.Properties {
|
||||
for _, nn := range n.Props {
|
||||
nn.Accept(t)
|
||||
}
|
||||
}
|
||||
@@ -356,7 +356,7 @@ func (t *Traverser) StmtSwitch(n *ast.StmtSwitch) {
|
||||
n.Accept(t.v)
|
||||
|
||||
t.Traverse(n.Cond)
|
||||
for _, nn := range n.CaseList {
|
||||
for _, nn := range n.Cases {
|
||||
nn.Accept(t)
|
||||
}
|
||||
}
|
||||
@@ -370,7 +370,7 @@ func (t *Traverser) StmtThrow(n *ast.StmtThrow) {
|
||||
func (t *Traverser) StmtTrait(n *ast.StmtTrait) {
|
||||
n.Accept(t.v)
|
||||
|
||||
t.Traverse(n.TraitName)
|
||||
t.Traverse(n.Name)
|
||||
for _, nn := range n.Stmts {
|
||||
nn.Accept(t)
|
||||
}
|
||||
@@ -426,26 +426,26 @@ func (t *Traverser) StmtUnset(n *ast.StmtUnset) {
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Traverser) StmtUse(n *ast.StmtUse) {
|
||||
func (t *Traverser) StmtUse(n *ast.StmtUseList) {
|
||||
n.Accept(t.v)
|
||||
|
||||
t.Traverse(n.Type)
|
||||
for _, nn := range n.UseDeclarations {
|
||||
for _, nn := range n.Uses {
|
||||
nn.Accept(t)
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Traverser) StmtGroupUse(n *ast.StmtGroupUse) {
|
||||
func (t *Traverser) StmtGroupUse(n *ast.StmtGroupUseList) {
|
||||
n.Accept(t.v)
|
||||
|
||||
t.Traverse(n.Type)
|
||||
t.Traverse(n.Prefix)
|
||||
for _, nn := range n.UseDeclarations {
|
||||
for _, nn := range n.Uses {
|
||||
nn.Accept(t)
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Traverser) StmtUseDeclaration(n *ast.StmtUseDeclaration) {
|
||||
func (t *Traverser) StmtUseDeclaration(n *ast.StmtUse) {
|
||||
n.Accept(t.v)
|
||||
|
||||
t.Traverse(n.Type)
|
||||
@@ -514,7 +514,7 @@ func (t *Traverser) ExprClassConstFetch(n *ast.ExprClassConstFetch) {
|
||||
n.Accept(t.v)
|
||||
|
||||
t.Traverse(n.Class)
|
||||
t.Traverse(n.ConstantName)
|
||||
t.Traverse(n.Const)
|
||||
}
|
||||
|
||||
func (t *Traverser) ExprClone(n *ast.ExprClone) {
|
||||
@@ -529,7 +529,7 @@ func (t *Traverser) ExprClosure(n *ast.ExprClosure) {
|
||||
for _, nn := range n.Params {
|
||||
nn.Accept(t)
|
||||
}
|
||||
for _, nn := range n.Use {
|
||||
for _, nn := range n.Uses {
|
||||
nn.Accept(t)
|
||||
}
|
||||
t.Traverse(n.ReturnType)
|
||||
@@ -578,7 +578,7 @@ func (t *Traverser) ExprFunctionCall(n *ast.ExprFunctionCall) {
|
||||
n.Accept(t.v)
|
||||
|
||||
t.Traverse(n.Function)
|
||||
for _, nn := range n.Arguments {
|
||||
for _, nn := range n.Args {
|
||||
nn.Accept(t)
|
||||
}
|
||||
}
|
||||
@@ -623,7 +623,7 @@ func (t *Traverser) ExprMethodCall(n *ast.ExprMethodCall) {
|
||||
|
||||
t.Traverse(n.Var)
|
||||
t.Traverse(n.Method)
|
||||
for _, nn := range n.Arguments {
|
||||
for _, nn := range n.Args {
|
||||
nn.Accept(t)
|
||||
}
|
||||
}
|
||||
@@ -632,7 +632,7 @@ func (t *Traverser) ExprNew(n *ast.ExprNew) {
|
||||
n.Accept(t.v)
|
||||
|
||||
t.Traverse(n.Class)
|
||||
for _, nn := range n.Arguments {
|
||||
for _, nn := range n.Args {
|
||||
nn.Accept(t)
|
||||
}
|
||||
}
|
||||
@@ -671,7 +671,7 @@ func (t *Traverser) ExprPropertyFetch(n *ast.ExprPropertyFetch) {
|
||||
n.Accept(t.v)
|
||||
|
||||
t.Traverse(n.Var)
|
||||
t.Traverse(n.Property)
|
||||
t.Traverse(n.Prop)
|
||||
}
|
||||
|
||||
func (t *Traverser) ExprRequire(n *ast.ExprRequire) {
|
||||
@@ -699,7 +699,7 @@ func (t *Traverser) ExprStaticCall(n *ast.ExprStaticCall) {
|
||||
|
||||
t.Traverse(n.Class)
|
||||
t.Traverse(n.Call)
|
||||
for _, nn := range n.Arguments {
|
||||
for _, nn := range n.Args {
|
||||
nn.Accept(t)
|
||||
}
|
||||
}
|
||||
@@ -708,13 +708,13 @@ func (t *Traverser) ExprStaticPropertyFetch(n *ast.ExprStaticPropertyFetch) {
|
||||
n.Accept(t.v)
|
||||
|
||||
t.Traverse(n.Class)
|
||||
t.Traverse(n.Property)
|
||||
t.Traverse(n.Prop)
|
||||
}
|
||||
|
||||
func (t *Traverser) ExprTernary(n *ast.ExprTernary) {
|
||||
n.Accept(t.v)
|
||||
|
||||
t.Traverse(n.Condition)
|
||||
t.Traverse(n.Cond)
|
||||
t.Traverse(n.IfTrue)
|
||||
t.Traverse(n.IfFalse)
|
||||
}
|
||||
@@ -734,14 +734,14 @@ func (t *Traverser) ExprUnaryPlus(n *ast.ExprUnaryPlus) {
|
||||
func (t *Traverser) ExprVariable(n *ast.ExprVariable) {
|
||||
n.Accept(t.v)
|
||||
|
||||
t.Traverse(n.VarName)
|
||||
t.Traverse(n.Name)
|
||||
}
|
||||
|
||||
func (t *Traverser) ExprYield(n *ast.ExprYield) {
|
||||
n.Accept(t.v)
|
||||
|
||||
t.Traverse(n.Key)
|
||||
t.Traverse(n.Value)
|
||||
t.Traverse(n.Val)
|
||||
}
|
||||
|
||||
func (t *Traverser) ExprYieldFrom(n *ast.ExprYieldFrom) {
|
||||
@@ -1105,7 +1105,7 @@ func (t *Traverser) ScalarEncapsedStringPart(n *ast.ScalarEncapsedStringPart) {
|
||||
func (t *Traverser) ScalarEncapsedStringVar(n *ast.ScalarEncapsedStringVar) {
|
||||
n.Accept(t.v)
|
||||
|
||||
t.Traverse(n.VarName)
|
||||
t.Traverse(n.Name)
|
||||
t.Traverse(n.Dim)
|
||||
}
|
||||
|
||||
@@ -1135,7 +1135,7 @@ func (t *Traverser) ScalarString(n *ast.ScalarString) {
|
||||
n.Accept(t.v)
|
||||
}
|
||||
|
||||
func (t *Traverser) NameName(n *ast.NameName) {
|
||||
func (t *Traverser) NameName(n *ast.Name) {
|
||||
n.Accept(t.v)
|
||||
|
||||
for _, nn := range n.Parts {
|
||||
@@ -1159,6 +1159,6 @@ func (t *Traverser) NameRelative(n *ast.NameRelative) {
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Traverser) NameNamePart(n *ast.NameNamePart) {
|
||||
func (t *Traverser) NameNamePart(n *ast.NamePart) {
|
||||
n.Accept(t.v)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user