create ArgumentList node
This commit is contained in:
parent
be3bdbfdc0
commit
8fc4c60bfe
@ -99,11 +99,13 @@ func TestReferenceArgs(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Variadic: false,
|
||||
IsReference: false,
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Variadic: false,
|
||||
IsReference: false,
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -7,15 +7,15 @@ import (
|
||||
|
||||
// FunctionCall node
|
||||
type FunctionCall struct {
|
||||
Function node.Node
|
||||
Arguments []node.Node
|
||||
Function node.Node
|
||||
ArgumentList *node.ArgumentList
|
||||
}
|
||||
|
||||
// NewFunctionCall node constructor
|
||||
func NewFunctionCall(Function node.Node, Arguments []node.Node) *FunctionCall {
|
||||
func NewFunctionCall(Function node.Node, ArgumentList *node.ArgumentList) *FunctionCall {
|
||||
return &FunctionCall{
|
||||
Function,
|
||||
Arguments,
|
||||
ArgumentList,
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,13 +36,9 @@ func (n *FunctionCall) Walk(v walker.Visitor) {
|
||||
n.Function.Walk(vv)
|
||||
}
|
||||
|
||||
if n.Arguments != nil {
|
||||
vv := v.GetChildrenVisitor("Arguments")
|
||||
for _, nn := range n.Arguments {
|
||||
if nn != nil {
|
||||
nn.Walk(vv)
|
||||
}
|
||||
}
|
||||
if n.ArgumentList != nil {
|
||||
vv := v.GetChildrenVisitor("ArgumentList")
|
||||
n.ArgumentList.Walk(vv)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
|
@ -7,17 +7,17 @@ import (
|
||||
|
||||
// MethodCall node
|
||||
type MethodCall struct {
|
||||
Variable node.Node
|
||||
Method node.Node
|
||||
Arguments []node.Node
|
||||
Variable node.Node
|
||||
Method node.Node
|
||||
ArgumentList *node.ArgumentList
|
||||
}
|
||||
|
||||
// NewMethodCall node constructor
|
||||
func NewMethodCall(Variable node.Node, Method node.Node, Arguments []node.Node) *MethodCall {
|
||||
func NewMethodCall(Variable node.Node, Method node.Node, ArgumentList *node.ArgumentList) *MethodCall {
|
||||
return &MethodCall{
|
||||
Variable,
|
||||
Method,
|
||||
Arguments,
|
||||
ArgumentList,
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,13 +43,9 @@ func (n *MethodCall) Walk(v walker.Visitor) {
|
||||
n.Method.Walk(vv)
|
||||
}
|
||||
|
||||
if n.Arguments != nil {
|
||||
vv := v.GetChildrenVisitor("Arguments")
|
||||
for _, nn := range n.Arguments {
|
||||
if nn != nil {
|
||||
nn.Walk(vv)
|
||||
}
|
||||
}
|
||||
if n.ArgumentList != nil {
|
||||
vv := v.GetChildrenVisitor("ArgumentList")
|
||||
n.ArgumentList.Walk(vv)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
|
@ -7,15 +7,15 @@ import (
|
||||
|
||||
// New node
|
||||
type New struct {
|
||||
Class node.Node
|
||||
Arguments []node.Node
|
||||
Class node.Node
|
||||
ArgumentList *node.ArgumentList
|
||||
}
|
||||
|
||||
// NewNew node constructor
|
||||
func NewNew(Class node.Node, Arguments []node.Node) *New {
|
||||
func NewNew(Class node.Node, ArgumentList *node.ArgumentList) *New {
|
||||
return &New{
|
||||
Class,
|
||||
Arguments,
|
||||
ArgumentList,
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,13 +36,9 @@ func (n *New) Walk(v walker.Visitor) {
|
||||
n.Class.Walk(vv)
|
||||
}
|
||||
|
||||
if n.Arguments != nil {
|
||||
vv := v.GetChildrenVisitor("Arguments")
|
||||
for _, nn := range n.Arguments {
|
||||
if nn != nil {
|
||||
nn.Walk(vv)
|
||||
}
|
||||
}
|
||||
if n.ArgumentList != nil {
|
||||
vv := v.GetChildrenVisitor("ArgumentList")
|
||||
n.ArgumentList.Walk(vv)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
|
@ -7,17 +7,17 @@ import (
|
||||
|
||||
// StaticCall node
|
||||
type StaticCall struct {
|
||||
Class node.Node
|
||||
Call node.Node
|
||||
Arguments []node.Node
|
||||
Class node.Node
|
||||
Call node.Node
|
||||
ArgumentList *node.ArgumentList
|
||||
}
|
||||
|
||||
// NewStaticCall node constructor
|
||||
func NewStaticCall(Class node.Node, Call node.Node, Arguments []node.Node) *StaticCall {
|
||||
func NewStaticCall(Class node.Node, Call node.Node, ArgumentList *node.ArgumentList) *StaticCall {
|
||||
return &StaticCall{
|
||||
Class,
|
||||
Call,
|
||||
Arguments,
|
||||
ArgumentList,
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,13 +43,9 @@ func (n *StaticCall) Walk(v walker.Visitor) {
|
||||
n.Call.Walk(vv)
|
||||
}
|
||||
|
||||
if n.Arguments != nil {
|
||||
vv := v.GetChildrenVisitor("Arguments")
|
||||
for _, nn := range n.Arguments {
|
||||
if nn != nil {
|
||||
nn.Walk(vv)
|
||||
}
|
||||
}
|
||||
if n.ArgumentList != nil {
|
||||
vv := v.GetChildrenVisitor("ArgumentList")
|
||||
n.ArgumentList.Walk(vv)
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
|
@ -29,7 +29,7 @@ func TestFunctionCall(t *testing.T) {
|
||||
&name.NamePart{Value: "foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -58,7 +58,7 @@ func TestFunctionCallRelative(t *testing.T) {
|
||||
&name.NamePart{Value: "foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -87,12 +87,14 @@ func TestFunctionFullyQualified(t *testing.T) {
|
||||
&name.NamePart{Value: "foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Variadic: false,
|
||||
IsReference: false,
|
||||
Expr: &expr.ShortArray{
|
||||
Items: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Variadic: false,
|
||||
IsReference: false,
|
||||
Expr: &expr.ShortArray{
|
||||
Items: []node.Node{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -120,12 +122,14 @@ func TestFunctionCallVar(t *testing.T) {
|
||||
&stmt.Expression{
|
||||
Expr: &expr.FunctionCall{
|
||||
Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Variadic: false,
|
||||
IsReference: false,
|
||||
Expr: &expr.Yield{
|
||||
Value: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Variadic: false,
|
||||
IsReference: false,
|
||||
Expr: &expr.Yield{
|
||||
Value: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -157,13 +161,15 @@ func TestFunctionCallExprArg(t *testing.T) {
|
||||
&name.NamePart{Value: "ceil"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Variadic: false,
|
||||
IsReference: false,
|
||||
Expr: &binary.Div{
|
||||
Left: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Right: &scalar.Lnumber{Value: "3"},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Variadic: false,
|
||||
IsReference: false,
|
||||
Expr: &binary.Div{
|
||||
Left: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Right: &scalar.Lnumber{Value: "3"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -19,9 +19,9 @@ func TestMethodCall(t *testing.T) {
|
||||
Stmts: []node.Node{
|
||||
&stmt.Expression{
|
||||
Expr: &expr.MethodCall{
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
Method: &node.Identifier{Value: "foo"},
|
||||
Arguments: []node.Node{},
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
Method: &node.Identifier{Value: "foo"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -54,7 +54,7 @@ func TestNewRelative(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -83,7 +83,7 @@ func TestNewFullyQualified(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -109,9 +109,11 @@ func TestNewAnonymous(t *testing.T) {
|
||||
Expr: &expr.New{
|
||||
Class: &stmt.Class{
|
||||
PhpDocComment: "",
|
||||
Args: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
},
|
||||
|
@ -26,8 +26,8 @@ func TestStaticCall(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -56,8 +56,8 @@ func TestStaticCallRelative(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -86,8 +86,8 @@ func TestStaticCallFullyQualified(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -116,8 +116,8 @@ func TestStaticCallVar(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
|
||||
Arguments: []node.Node{},
|
||||
Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -141,9 +141,9 @@ func TestStaticCallVarVar(t *testing.T) {
|
||||
Stmts: []node.Node{
|
||||
&stmt.Expression{
|
||||
Expr: &expr.StaticCall{
|
||||
Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
|
||||
Arguments: []node.Node{},
|
||||
Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -146,10 +146,10 @@ var nodesToTest = []struct {
|
||||
},
|
||||
{
|
||||
&expr.FunctionCall{
|
||||
Function: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
Arguments: []node.Node{&node.Argument{}},
|
||||
Function: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
[]string{"Function", "Arguments"},
|
||||
[]string{"Function", "ArgumentList"},
|
||||
map[string]interface{}{},
|
||||
},
|
||||
{
|
||||
@ -194,19 +194,19 @@ var nodesToTest = []struct {
|
||||
},
|
||||
{
|
||||
&expr.MethodCall{
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
Method: &node.Identifier{Value: "foo"},
|
||||
Arguments: []node.Node{&node.Argument{}},
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
Method: &node.Identifier{Value: "foo"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
[]string{"Variable", "Method", "Arguments"},
|
||||
[]string{"Variable", "Method", "ArgumentList"},
|
||||
map[string]interface{}{},
|
||||
},
|
||||
{
|
||||
&expr.New{
|
||||
Class: &name.Name{},
|
||||
Arguments: []node.Node{&node.Argument{}},
|
||||
Class: &name.Name{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
[]string{"Class", "Arguments"},
|
||||
[]string{"Class", "ArgumentList"},
|
||||
map[string]interface{}{},
|
||||
},
|
||||
{
|
||||
@ -295,11 +295,11 @@ var nodesToTest = []struct {
|
||||
},
|
||||
{
|
||||
&expr.StaticCall{
|
||||
Class: &name.Name{},
|
||||
Call: &node.Identifier{Value: "foo"},
|
||||
Arguments: []node.Node{&node.Argument{}},
|
||||
Class: &name.Name{},
|
||||
Call: &node.Identifier{Value: "foo"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
[]string{"Class", "Call", "Arguments"},
|
||||
[]string{"Class", "Call", "ArgumentList"},
|
||||
map[string]interface{}{},
|
||||
},
|
||||
{
|
||||
|
41
node/n_argument_list.go
Normal file
41
node/n_argument_list.go
Normal file
@ -0,0 +1,41 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/walker"
|
||||
)
|
||||
|
||||
// ArgumentList node
|
||||
type ArgumentList struct {
|
||||
Arguments []Node
|
||||
}
|
||||
|
||||
// NewArgumentList node constructor
|
||||
func NewArgumentList(Arguments []Node) *ArgumentList {
|
||||
return &ArgumentList{
|
||||
Arguments,
|
||||
}
|
||||
}
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *ArgumentList) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
// Walk is invoked recursively until v.EnterNode returns true
|
||||
func (n *ArgumentList) Walk(v walker.Visitor) {
|
||||
if v.EnterNode(n) == false {
|
||||
return
|
||||
}
|
||||
|
||||
if n.Arguments != nil {
|
||||
vv := v.GetChildrenVisitor("Arguments")
|
||||
for _, nn := range n.Arguments {
|
||||
if nn != nil {
|
||||
nn.Walk(vv)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
v.LeaveNode(n)
|
||||
}
|
@ -38,7 +38,7 @@ func TestName(t *testing.T) {
|
||||
Function: &name.Name{
|
||||
Parts: []node.Node{&name.NamePart{Value: "foo"}},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -65,7 +65,7 @@ func TestFullyQualified(t *testing.T) {
|
||||
Function: &name.FullyQualified{
|
||||
Parts: []node.Node{&name.NamePart{Value: "foo"}},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -92,7 +92,7 @@ func TestRelative(t *testing.T) {
|
||||
Function: &name.Relative{
|
||||
Parts: []node.Node{&name.NamePart{Value: "foo"}},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -221,9 +221,9 @@ func TestCurlyOpenMethodCall(t *testing.T) {
|
||||
Parts: []node.Node{
|
||||
&scalar.EncapsedStringPart{Value: "test "},
|
||||
&expr.MethodCall{
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Method: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{},
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Method: &node.Identifier{Value: "bar"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -10,19 +10,19 @@ type Class struct {
|
||||
PhpDocComment string
|
||||
ClassName node.Node
|
||||
Modifiers []node.Node
|
||||
Args []node.Node
|
||||
ArgumentList *node.ArgumentList
|
||||
Extends node.Node
|
||||
Implements []node.Node
|
||||
Stmts []node.Node
|
||||
}
|
||||
|
||||
// NewClass node constructor
|
||||
func NewClass(ClassName node.Node, Modifiers []node.Node, Args []node.Node, Extends node.Node, Implements []node.Node, Stmts []node.Node, PhpDocComment string) *Class {
|
||||
func NewClass(ClassName node.Node, Modifiers []node.Node, ArgumentList *node.ArgumentList, Extends node.Node, Implements []node.Node, Stmts []node.Node, PhpDocComment string) *Class {
|
||||
return &Class{
|
||||
PhpDocComment,
|
||||
ClassName,
|
||||
Modifiers,
|
||||
Args,
|
||||
ArgumentList,
|
||||
Extends,
|
||||
Implements,
|
||||
Stmts,
|
||||
@ -57,13 +57,9 @@ func (n *Class) Walk(v walker.Visitor) {
|
||||
}
|
||||
}
|
||||
|
||||
if n.Args != nil {
|
||||
vv := v.GetChildrenVisitor("Args")
|
||||
for _, nn := range n.Args {
|
||||
if nn != nil {
|
||||
nn.Walk(vv)
|
||||
}
|
||||
}
|
||||
if n.ArgumentList != nil {
|
||||
vv := v.GetChildrenVisitor("ArgumentList")
|
||||
n.ArgumentList.Walk(vv)
|
||||
}
|
||||
|
||||
if n.Extends != nil {
|
||||
|
@ -2,9 +2,10 @@ package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"github.com/z7zmey/php-parser/node/expr"
|
||||
"github.com/z7zmey/php-parser/node/name"
|
||||
"testing"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/node/stmt"
|
||||
@ -171,7 +172,7 @@ func TestAnonimousClass(t *testing.T) {
|
||||
&stmt.Expression{
|
||||
Expr: &expr.New{
|
||||
Class: &stmt.Class{
|
||||
Args: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
Extends: &name.Name{
|
||||
Parts: []node.Node{
|
||||
&name.NamePart{Value: "foo"},
|
||||
|
@ -53,7 +53,7 @@ func TestGlobalVars(t *testing.T) {
|
||||
&name.NamePart{Value: "foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -92,12 +92,12 @@ var nodesToTest = []struct {
|
||||
PhpDocComment: "/** */",
|
||||
ClassName: &node.Identifier{},
|
||||
Modifiers: []node.Node{&stmt.Expression{}},
|
||||
Args: []node.Node{&stmt.Expression{}},
|
||||
Extends: &node.Identifier{},
|
||||
Implements: []node.Node{&stmt.Expression{}},
|
||||
Stmts: []node.Node{&stmt.Expression{}},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
Extends: &node.Identifier{},
|
||||
Implements: []node.Node{&stmt.Expression{}},
|
||||
Stmts: []node.Node{&stmt.Expression{}},
|
||||
},
|
||||
[]string{"ClassName", "Modifiers", "Args", "Extends", "Implements", "Stmts"},
|
||||
[]string{"ClassName", "Modifiers", "ArgumentList", "Extends", "Implements", "Stmts"},
|
||||
map[string]interface{}{"PhpDocComment": "/** */"},
|
||||
},
|
||||
{
|
||||
|
@ -70,18 +70,22 @@ func TestPhp7ArgumentNode(t *testing.T) {
|
||||
&stmt.Expression{
|
||||
Expr: &expr.FunctionCall{
|
||||
Function: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.FunctionCall{
|
||||
Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -89,9 +93,11 @@ func TestPhp7ArgumentNode(t *testing.T) {
|
||||
Expr: &expr.MethodCall{
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Method: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -99,9 +105,11 @@ func TestPhp7ArgumentNode(t *testing.T) {
|
||||
Expr: &expr.StaticCall{
|
||||
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -109,18 +117,22 @@ func TestPhp7ArgumentNode(t *testing.T) {
|
||||
Expr: &expr.StaticCall{
|
||||
Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.New{
|
||||
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -128,9 +140,11 @@ func TestPhp7ArgumentNode(t *testing.T) {
|
||||
Expr: &expr.New{
|
||||
Class: &stmt.Class{
|
||||
PhpDocComment: "/** anonymous class */",
|
||||
Args: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
},
|
||||
@ -160,18 +174,22 @@ func TestPhp5ArgumentNode(t *testing.T) {
|
||||
&stmt.Expression{
|
||||
Expr: &expr.FunctionCall{
|
||||
Function: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.FunctionCall{
|
||||
Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -179,9 +197,11 @@ func TestPhp5ArgumentNode(t *testing.T) {
|
||||
Expr: &expr.MethodCall{
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Method: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -189,9 +209,11 @@ func TestPhp5ArgumentNode(t *testing.T) {
|
||||
Expr: &expr.StaticCall{
|
||||
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -199,18 +221,22 @@ func TestPhp5ArgumentNode(t *testing.T) {
|
||||
Expr: &expr.StaticCall{
|
||||
Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.New{
|
||||
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -44,6 +44,15 @@ var nodesToTest = []struct {
|
||||
[]string{"VariableType", "Variable", "DefaultValue"},
|
||||
map[string]interface{}{"ByRef": false, "Variadic": true},
|
||||
},
|
||||
{
|
||||
&node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{},
|
||||
},
|
||||
},
|
||||
[]string{"Arguments"},
|
||||
map[string]interface{}{},
|
||||
},
|
||||
}
|
||||
|
||||
type visitorMock struct {
|
||||
|
1348
php5/php5.go
1348
php5/php5.go
File diff suppressed because it is too large
Load Diff
75
php5/php5.y
75
php5/php5.y
@ -242,6 +242,7 @@ import (
|
||||
%type <node> trait_use_statement function_call_parameter trait_adaptation_statement trait_precedence trait_alias
|
||||
%type <node> trait_method_reference_fully_qualified trait_method_reference trait_modifiers member_modifier method
|
||||
%type <node> static_scalar_value static_operation
|
||||
%type <node> ctor_arguments function_call_parameter_list
|
||||
|
||||
%type <list> top_statement_list namespace_name use_declarations use_function_declarations use_const_declarations
|
||||
%type <list> inner_statement_list global_var_list static_var_list encaps_list isset_variables non_empty_array_pair_list
|
||||
@ -258,7 +259,7 @@ import (
|
||||
|
||||
%type <simpleIndirectReference> simple_indirect_reference
|
||||
%type <foreachVariable> foreach_variable foreach_optional_arg
|
||||
%type <nodesWithEndToken> ctor_arguments function_call_parameter_list switch_case_list method_body trait_adaptations
|
||||
%type <nodesWithEndToken> switch_case_list method_body trait_adaptations
|
||||
%type <boolWithToken> is_reference is_variadic
|
||||
%type <altSyntaxNode> while_statement for_statement foreach_statement
|
||||
|
||||
@ -1349,16 +1350,27 @@ optional_class_type:
|
||||
|
||||
function_call_parameter_list:
|
||||
'(' ')'
|
||||
{ $$ = &nodesWithEndToken{[]node.Node{}, $2} }
|
||||
{
|
||||
$$ = node.NewArgumentList(nil)
|
||||
|
||||
// save position
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2))
|
||||
}
|
||||
| '(' non_empty_function_call_parameter_list ')'
|
||||
{ $$ = &nodesWithEndToken{$2, $3} }
|
||||
{
|
||||
$$ = node.NewArgumentList($2)
|
||||
|
||||
// save position
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
|
||||
}
|
||||
| '(' yield_expr ')'
|
||||
{
|
||||
arg := node.NewArgument($2, false, false)
|
||||
yylex.(*Parser).positions.AddPosition(arg, yylex.(*Parser).positionBuilder.NewNodePosition($2))
|
||||
yylex.(*Parser).comments.AddComments(arg, yylex.(*Parser).comments[$2])
|
||||
$$ = node.NewArgumentList([]node.Node{arg})
|
||||
|
||||
$$ = &nodesWithEndToken{[]node.Node{arg}, $3}
|
||||
// save position
|
||||
yylex.(*Parser).positions.AddPosition(arg, yylex.(*Parser).positionBuilder.NewNodePosition($2))
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
|
||||
}
|
||||
;
|
||||
|
||||
@ -1886,9 +1898,10 @@ instance_call:
|
||||
new_expr:
|
||||
T_NEW class_name_reference ctor_arguments
|
||||
{
|
||||
|
||||
if $3 != nil {
|
||||
$$ = expr.NewNew($2, $3.nodes)
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3.endToken))
|
||||
$$ = expr.NewNew($2, $3.(*node.ArgumentList))
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3))
|
||||
} else {
|
||||
$$ = expr.NewNew($2, nil)
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
|
||||
@ -1923,12 +1936,14 @@ expr_without_variable:
|
||||
}
|
||||
| variable '=' '&' T_NEW class_name_reference ctor_arguments
|
||||
{
|
||||
_new := expr.NewNew($5, nil)
|
||||
yylex.(*Parser).positions.AddPosition(_new, yylex.(*Parser).positionBuilder.NewTokenNodePosition($4, $5))
|
||||
var _new *expr.New
|
||||
|
||||
if $6 != nil {
|
||||
_new = expr.NewNew($5, $6.nodes)
|
||||
yylex.(*Parser).positions.AddPosition(_new, yylex.(*Parser).positionBuilder.NewTokensPosition($4, $6.endToken))
|
||||
_new = expr.NewNew($5, $6.(*node.ArgumentList))
|
||||
yylex.(*Parser).positions.AddPosition(_new, yylex.(*Parser).positionBuilder.NewTokenNodePosition($4, $6))
|
||||
} else {
|
||||
_new = expr.NewNew($5, nil)
|
||||
yylex.(*Parser).positions.AddPosition(_new, yylex.(*Parser).positionBuilder.NewTokenNodePosition($4, $5))
|
||||
}
|
||||
yylex.(*Parser).comments.AddComments(_new, yylex.(*Parser).comments[$1])
|
||||
|
||||
@ -2519,8 +2534,8 @@ function_call:
|
||||
yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1))
|
||||
yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1))
|
||||
|
||||
$$ = expr.NewFunctionCall(name, $2.nodes)
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(name, $2.endToken))
|
||||
$$ = expr.NewFunctionCall(name, $2.(*node.ArgumentList))
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition(name, $2))
|
||||
yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[name])
|
||||
}
|
||||
| T_NAMESPACE T_NS_SEPARATOR namespace_name function_call_parameter_list
|
||||
@ -2529,8 +2544,8 @@ function_call:
|
||||
yylex.(*Parser).positions.AddPosition(funcName, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3))
|
||||
yylex.(*Parser).comments.AddComments(funcName, $1.Comments())
|
||||
|
||||
$$ = expr.NewFunctionCall(funcName, $4.nodes)
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(funcName, $4.endToken))
|
||||
$$ = expr.NewFunctionCall(funcName, $4.(*node.ArgumentList))
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition(funcName, $4))
|
||||
yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[funcName])
|
||||
}
|
||||
| T_NS_SEPARATOR namespace_name function_call_parameter_list
|
||||
@ -2539,38 +2554,38 @@ function_call:
|
||||
yylex.(*Parser).positions.AddPosition(funcName, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2))
|
||||
yylex.(*Parser).comments.AddComments(funcName, $1.Comments())
|
||||
|
||||
$$ = expr.NewFunctionCall(funcName, $3.nodes)
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(funcName, $3.endToken))
|
||||
$$ = expr.NewFunctionCall(funcName, $3.(*node.ArgumentList))
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition(funcName, $3))
|
||||
yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[funcName])
|
||||
}
|
||||
| class_name T_PAAMAYIM_NEKUDOTAYIM variable_name function_call_parameter_list
|
||||
{
|
||||
$$ = expr.NewStaticCall($1, $3, $4.nodes)
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4.endToken))
|
||||
$$ = expr.NewStaticCall($1, $3, $4.(*node.ArgumentList))
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
|
||||
yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
|
||||
}
|
||||
| class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects function_call_parameter_list
|
||||
{
|
||||
$$ = expr.NewStaticCall($1, $3, $4.nodes)
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4.endToken))
|
||||
$$ = expr.NewStaticCall($1, $3, $4.(*node.ArgumentList))
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
|
||||
yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
|
||||
}
|
||||
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_name function_call_parameter_list
|
||||
{
|
||||
$$ = expr.NewStaticCall($1, $3, $4.nodes)
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4.endToken))
|
||||
$$ = expr.NewStaticCall($1, $3, $4.(*node.ArgumentList))
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
|
||||
yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
|
||||
}
|
||||
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects function_call_parameter_list
|
||||
{
|
||||
$$ = expr.NewStaticCall($1, $3, $4.nodes)
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4.endToken))
|
||||
$$ = expr.NewStaticCall($1, $3, $4.(*node.ArgumentList))
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4))
|
||||
yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
|
||||
}
|
||||
| variable_without_objects function_call_parameter_list
|
||||
{
|
||||
$$ = expr.NewFunctionCall($1, $2.nodes)
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2.endToken))
|
||||
$$ = expr.NewFunctionCall($1, $2.(*node.ArgumentList))
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $2))
|
||||
yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1])
|
||||
}
|
||||
;
|
||||
@ -3311,8 +3326,8 @@ array_method_dereference:
|
||||
method:
|
||||
function_call_parameter_list
|
||||
{
|
||||
$$ = expr.NewMethodCall(nil, nil, $1.nodes)
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($1.nodes, $1.endToken))
|
||||
$$ = expr.NewMethodCall(nil, nil, $1.(*node.ArgumentList))
|
||||
yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1))
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -434,18 +434,22 @@ func TestPhp5(t *testing.T) {
|
||||
&stmt.Expression{
|
||||
Expr: &expr.FunctionCall{
|
||||
Function: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.FunctionCall{
|
||||
Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -453,9 +457,11 @@ func TestPhp5(t *testing.T) {
|
||||
Expr: &expr.MethodCall{
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Method: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -463,9 +469,11 @@ func TestPhp5(t *testing.T) {
|
||||
Expr: &expr.StaticCall{
|
||||
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -473,18 +481,22 @@ func TestPhp5(t *testing.T) {
|
||||
Expr: &expr.StaticCall{
|
||||
Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.New{
|
||||
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -665,9 +677,9 @@ func TestPhp5(t *testing.T) {
|
||||
Parts: []node.Node{
|
||||
&scalar.EncapsedStringPart{Value: "test "},
|
||||
&expr.MethodCall{
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Method: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{},
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Method: &node.Identifier{Value: "bar"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -1134,7 +1146,7 @@ func TestPhp5(t *testing.T) {
|
||||
&name.NamePart{Value: "foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -2081,7 +2093,7 @@ func TestPhp5(t *testing.T) {
|
||||
&name.NamePart{Value: "foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -2091,11 +2103,13 @@ func TestPhp5(t *testing.T) {
|
||||
&name.NamePart{Value: "foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Variadic: false,
|
||||
IsReference: true,
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Variadic: false,
|
||||
IsReference: true,
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -2107,12 +2121,14 @@ func TestPhp5(t *testing.T) {
|
||||
&name.NamePart{Value: "foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Variadic: false,
|
||||
IsReference: false,
|
||||
Expr: &expr.ShortArray{
|
||||
Items: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Variadic: false,
|
||||
IsReference: false,
|
||||
Expr: &expr.ShortArray{
|
||||
Items: []node.Node{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -2121,12 +2137,14 @@ func TestPhp5(t *testing.T) {
|
||||
&stmt.Expression{
|
||||
Expr: &expr.FunctionCall{
|
||||
Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Variadic: false,
|
||||
IsReference: false,
|
||||
Expr: &expr.Yield{
|
||||
Value: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Variadic: false,
|
||||
IsReference: false,
|
||||
Expr: &expr.Yield{
|
||||
Value: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -2281,9 +2299,9 @@ func TestPhp5(t *testing.T) {
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.MethodCall{
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
Method: &node.Identifier{Value: "foo"},
|
||||
Arguments: []node.Node{},
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
Method: &node.Identifier{Value: "foo"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -2302,7 +2320,7 @@ func TestPhp5(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -2312,7 +2330,7 @@ func TestPhp5(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -2346,8 +2364,8 @@ func TestPhp5(t *testing.T) {
|
||||
},
|
||||
Property: &node.Identifier{Value: "bar"},
|
||||
},
|
||||
Method: &node.Identifier{Value: "baz"},
|
||||
Arguments: []node.Node{},
|
||||
Method: &node.Identifier{Value: "baz"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
Property: &node.Identifier{Value: "quux"},
|
||||
},
|
||||
@ -2358,9 +2376,9 @@ func TestPhp5(t *testing.T) {
|
||||
Expr: &expr.ArrayDimFetch{
|
||||
Variable: &expr.ArrayDimFetch{
|
||||
Variable: &expr.MethodCall{
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
Method: &node.Identifier{Value: "foo"},
|
||||
Arguments: []node.Node{},
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
Method: &node.Identifier{Value: "foo"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
Dim: &scalar.Lnumber{Value: "1"},
|
||||
},
|
||||
@ -2424,8 +2442,8 @@ func TestPhp5(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -2435,8 +2453,8 @@ func TestPhp5(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -2446,8 +2464,8 @@ func TestPhp5(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -2457,15 +2475,15 @@ func TestPhp5(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
|
||||
Arguments: []node.Node{},
|
||||
Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.StaticCall{
|
||||
Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
|
||||
Arguments: []node.Node{},
|
||||
Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -2815,11 +2833,13 @@ func TestPhp5(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Variadic: false,
|
||||
IsReference: false,
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Variadic: false,
|
||||
IsReference: false,
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -2910,7 +2930,7 @@ func TestPhp5(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -2922,10 +2942,10 @@ func TestPhp5(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
Method: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{},
|
||||
Method: &node.Identifier{Value: "bar"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
Property: &node.Identifier{Value: "baz"},
|
||||
},
|
||||
@ -2939,7 +2959,7 @@ func TestPhp5(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
Dim: &scalar.Lnumber{Value: "0"},
|
||||
},
|
||||
@ -2955,12 +2975,12 @@ func TestPhp5(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
Dim: &scalar.Lnumber{Value: "0"},
|
||||
},
|
||||
Method: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{},
|
||||
Method: &node.Identifier{Value: "bar"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -3574,16 +3594,16 @@ func TestPhp5(t *testing.T) {
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.FunctionCall{
|
||||
Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Arguments: []node.Node{},
|
||||
Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.ArrayDimFetch{
|
||||
Variable: &expr.ArrayDimFetch{
|
||||
Variable: &expr.FunctionCall{
|
||||
Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Arguments: []node.Node{},
|
||||
Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
Dim: &scalar.Lnumber{Value: "0"},
|
||||
},
|
||||
@ -3601,9 +3621,9 @@ func TestPhp5(t *testing.T) {
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.StaticCall{
|
||||
Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
|
||||
Arguments: []node.Node{},
|
||||
Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
|
1098
php7/php7.go
1098
php7/php7.go
File diff suppressed because it is too large
Load Diff
449
php7/php7.y
449
php7/php7.y
File diff suppressed because it is too large
Load Diff
@ -402,18 +402,22 @@ func TestPhp7(t *testing.T) {
|
||||
&stmt.Expression{
|
||||
Expr: &expr.FunctionCall{
|
||||
Function: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.FunctionCall{
|
||||
Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -421,9 +425,11 @@ func TestPhp7(t *testing.T) {
|
||||
Expr: &expr.MethodCall{
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Method: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -431,9 +437,11 @@ func TestPhp7(t *testing.T) {
|
||||
Expr: &expr.StaticCall{
|
||||
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -441,18 +449,22 @@ func TestPhp7(t *testing.T) {
|
||||
Expr: &expr.StaticCall{
|
||||
Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.New{
|
||||
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -460,9 +472,11 @@ func TestPhp7(t *testing.T) {
|
||||
Expr: &expr.New{
|
||||
Class: &stmt.Class{
|
||||
PhpDocComment: "/** anonymous class */",
|
||||
Args: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
},
|
||||
@ -730,9 +744,10 @@ func TestPhp7(t *testing.T) {
|
||||
Parts: []node.Node{
|
||||
&scalar.EncapsedStringPart{Value: "test "},
|
||||
&expr.MethodCall{
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Method: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{},
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Method: &node.Identifier{Value: "bar"},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -945,7 +960,8 @@ func TestPhp7(t *testing.T) {
|
||||
&stmt.Expression{
|
||||
Expr: &expr.New{
|
||||
Class: &stmt.Class{
|
||||
Args: []node.Node{},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
Extends: &name.Name{
|
||||
Parts: []node.Node{
|
||||
&name.NamePart{Value: "foo"},
|
||||
@ -2168,7 +2184,8 @@ func TestPhp7(t *testing.T) {
|
||||
&name.NamePart{Value: "foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -2178,7 +2195,8 @@ func TestPhp7(t *testing.T) {
|
||||
&name.NamePart{Value: "foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -2188,13 +2206,15 @@ func TestPhp7(t *testing.T) {
|
||||
&name.NamePart{Value: "foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.FunctionCall{
|
||||
Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Arguments: []node.Node{},
|
||||
Function: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -2325,9 +2345,10 @@ func TestPhp7(t *testing.T) {
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.MethodCall{
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
Method: &node.Identifier{Value: "foo"},
|
||||
Arguments: []node.Node{},
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
Method: &node.Identifier{Value: "foo"},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -2337,7 +2358,8 @@ func TestPhp7(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -2347,7 +2369,8 @@ func TestPhp7(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -2357,16 +2380,20 @@ func TestPhp7(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.New{
|
||||
Class: &stmt.Class{
|
||||
PhpDocComment: "",
|
||||
Args: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
|
||||
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
|
||||
},
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
},
|
||||
@ -2488,8 +2515,9 @@ func TestPhp7(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -2499,8 +2527,9 @@ func TestPhp7(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -2510,8 +2539,9 @@ func TestPhp7(t *testing.T) {
|
||||
&name.NamePart{Value: "Foo"},
|
||||
},
|
||||
},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -2931,7 +2961,8 @@ func TestPhp7(t *testing.T) {
|
||||
&name.NamePart{Value: "bar"},
|
||||
},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Function{
|
||||
@ -3048,7 +3079,8 @@ func TestPhp7(t *testing.T) {
|
||||
Function: &expr.New{
|
||||
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Foo"}}},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -3064,7 +3096,8 @@ func TestPhp7(t *testing.T) {
|
||||
},
|
||||
Dim: &scalar.Lnumber{Value: "0"},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -3075,13 +3108,15 @@ func TestPhp7(t *testing.T) {
|
||||
},
|
||||
Dim: &scalar.Lnumber{Value: "1"},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.FunctionCall{
|
||||
Function: &scalar.String{Value: "\"foo\""},
|
||||
Arguments: []node.Node{},
|
||||
Function: &scalar.String{Value: "\"foo\""},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -3097,22 +3132,25 @@ func TestPhp7(t *testing.T) {
|
||||
},
|
||||
Dim: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.Variable{
|
||||
VarName: &expr.FunctionCall{
|
||||
Function: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
|
||||
Arguments: []node.Node{},
|
||||
Function: &name.Name{Parts: []node.Node{&name.NamePart{Value: "foo"}}},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
Expr: &expr.StaticCall{
|
||||
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Foo"}}},
|
||||
Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
|
||||
Arguments: []node.Node{},
|
||||
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Foo"}}},
|
||||
Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
@ -3122,7 +3160,8 @@ func TestPhp7(t *testing.T) {
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
|
||||
Dim: &scalar.Lnumber{Value: "0"},
|
||||
},
|
||||
Arguments: []node.Node{},
|
||||
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
&stmt.Expression{
|
||||
|
@ -1097,7 +1097,7 @@ func (p *Printer) printExprFunctionCall(n node.Node) {
|
||||
|
||||
p.Print(nn.Function)
|
||||
io.WriteString(p.w, "(")
|
||||
p.joinPrint(", ", nn.Arguments)
|
||||
p.joinPrint(", ", nn.ArgumentList.Arguments)
|
||||
io.WriteString(p.w, ")")
|
||||
}
|
||||
|
||||
@ -1146,7 +1146,7 @@ func (p *Printer) printExprMethodCall(n node.Node) {
|
||||
io.WriteString(p.w, "->")
|
||||
p.Print(nn.Method)
|
||||
io.WriteString(p.w, "(")
|
||||
p.joinPrint(", ", nn.Arguments)
|
||||
p.joinPrint(", ", nn.ArgumentList.Arguments)
|
||||
io.WriteString(p.w, ")")
|
||||
}
|
||||
|
||||
@ -1156,9 +1156,9 @@ func (p *Printer) printExprNew(n node.Node) {
|
||||
io.WriteString(p.w, "new ")
|
||||
p.Print(nn.Class)
|
||||
|
||||
if nn.Arguments != nil {
|
||||
if nn.ArgumentList != nil {
|
||||
io.WriteString(p.w, "(")
|
||||
p.joinPrint(", ", nn.Arguments)
|
||||
p.joinPrint(", ", nn.ArgumentList.Arguments)
|
||||
io.WriteString(p.w, ")")
|
||||
}
|
||||
}
|
||||
@ -1254,7 +1254,7 @@ func (p *Printer) printExprStaticCall(n node.Node) {
|
||||
io.WriteString(p.w, "::")
|
||||
p.Print(nn.Call)
|
||||
io.WriteString(p.w, "(")
|
||||
p.joinPrint(", ", nn.Arguments)
|
||||
p.joinPrint(", ", nn.ArgumentList.Arguments)
|
||||
io.WriteString(p.w, ")")
|
||||
}
|
||||
|
||||
@ -1536,9 +1536,9 @@ func (p *Printer) printStmtClass(n node.Node) {
|
||||
p.Print(nn.ClassName)
|
||||
}
|
||||
|
||||
if nn.Args != nil {
|
||||
if nn.ArgumentList != nil {
|
||||
io.WriteString(p.w, "(")
|
||||
p.joinPrint(", ", nn.Args)
|
||||
p.joinPrint(", ", nn.ArgumentList.Arguments)
|
||||
io.WriteString(p.w, ")")
|
||||
}
|
||||
|
||||
|
@ -1522,17 +1522,19 @@ func TestPrintFunctionCall(t *testing.T) {
|
||||
p := printer.NewPrinter(o, " ")
|
||||
p.Print(&expr.FunctionCall{
|
||||
Function: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
IsReference: true,
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
},
|
||||
&node.Argument{
|
||||
Variadic: true,
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
|
||||
},
|
||||
&node.Argument{
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
IsReference: true,
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
},
|
||||
&node.Argument{
|
||||
Variadic: true,
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
|
||||
},
|
||||
&node.Argument{
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@ -1648,12 +1650,14 @@ func TestPrintMethodCall(t *testing.T) {
|
||||
p.Print(&expr.MethodCall{
|
||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Method: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
},
|
||||
&node.Argument{
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
},
|
||||
&node.Argument{
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@ -1672,12 +1676,14 @@ func TestPrintNew(t *testing.T) {
|
||||
p := printer.NewPrinter(o, " ")
|
||||
p.Print(&expr.New{
|
||||
Class: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Foo"}}},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
},
|
||||
&node.Argument{
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
},
|
||||
&node.Argument{
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@ -1901,12 +1907,14 @@ func TestPrintStaticCall(t *testing.T) {
|
||||
p.Print(&expr.StaticCall{
|
||||
Class: &node.Identifier{Value: "Foo"},
|
||||
Call: &node.Identifier{Value: "bar"},
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
},
|
||||
&node.Argument{
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
},
|
||||
&node.Argument{
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@ -2509,12 +2517,14 @@ func TestPrintStmtAnonymousClass(t *testing.T) {
|
||||
Stmts: []node.Node{
|
||||
&stmt.Class{
|
||||
Modifiers: []node.Node{&node.Identifier{Value: "abstract"}},
|
||||
Args: []node.Node{
|
||||
&node.Argument{
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
},
|
||||
&node.Argument{
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
|
||||
ArgumentList: &node.ArgumentList{
|
||||
Arguments: []node.Node{
|
||||
&node.Argument{
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
},
|
||||
&node.Argument{
|
||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
Extends: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Bar"}}},
|
||||
|
@ -43,9 +43,9 @@ func TestResolveStaticCall(t *testing.T) {
|
||||
},
|
||||
},
|
||||
&expr.StaticCall{
|
||||
Class: nameBC,
|
||||
Call: &node.Identifier{Value: "foo"},
|
||||
Arguments: []node.Node{},
|
||||
Class: nameBC,
|
||||
Call: &node.Identifier{Value: "foo"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -134,8 +134,8 @@ func TestResolveNew(t *testing.T) {
|
||||
},
|
||||
},
|
||||
&expr.New{
|
||||
Class: nameBC,
|
||||
Arguments: []node.Node{},
|
||||
Class: nameBC,
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -242,8 +242,8 @@ func TestResolveFunctionCall(t *testing.T) {
|
||||
},
|
||||
},
|
||||
&expr.FunctionCall{
|
||||
Function: nameB,
|
||||
Arguments: []node.Node{},
|
||||
Function: nameB,
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -323,12 +323,12 @@ func TestResolveGroupUse(t *testing.T) {
|
||||
Constant: nameC,
|
||||
},
|
||||
&expr.FunctionCall{
|
||||
Function: nameF,
|
||||
Arguments: []node.Node{},
|
||||
Function: nameF,
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
&expr.FunctionCall{
|
||||
Function: nameE,
|
||||
Arguments: []node.Node{},
|
||||
Function: nameE,
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -658,9 +658,9 @@ func TestResolveNamespaces(t *testing.T) {
|
||||
},
|
||||
},
|
||||
&expr.StaticCall{
|
||||
Class: nameFG,
|
||||
Call: &node.Identifier{Value: "foo"},
|
||||
Arguments: []node.Node{},
|
||||
Class: nameFG,
|
||||
Call: &node.Identifier{Value: "foo"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
&stmt.Namespace{
|
||||
Stmts: []node.Node{},
|
||||
@ -678,12 +678,12 @@ func TestResolveNamespaces(t *testing.T) {
|
||||
&expr.StaticCall{
|
||||
Class: relativeNameCE,
|
||||
Call: &node.Identifier{Value: "foo"},
|
||||
Arguments: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
&expr.StaticCall{
|
||||
Class: nameCF,
|
||||
Call: &node.Identifier{Value: "foo"},
|
||||
Arguments: []node.Node{},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -708,9 +708,9 @@ func TestResolveStaticCallDinamicClassName(t *testing.T) {
|
||||
ast := &stmt.StmtList{
|
||||
Stmts: []node.Node{
|
||||
&expr.StaticCall{
|
||||
Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Call: &node.Identifier{Value: "foo"},
|
||||
Arguments: []node.Node{},
|
||||
Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
|
||||
Call: &node.Identifier{Value: "foo"},
|
||||
ArgumentList: &node.ArgumentList{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user