trim $ from variable name identifier

This commit is contained in:
z7zmey 2018-03-18 16:50:19 +02:00
parent 7e6f7e7267
commit 643027db9a
58 changed files with 1107 additions and 1107 deletions

View File

@ -36,8 +36,8 @@ func TestAssignRef(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.AssignRef{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -57,7 +57,7 @@ func TestAssignRefNew(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.AssignRef{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.New{
Class: &name.Name{
Parts: []node.Node{
@ -84,7 +84,7 @@ func TestAssignRefArgs(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.AssignRef{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.New{
Class: &name.Name{
Parts: []node.Node{
@ -95,7 +95,7 @@ func TestAssignRefArgs(t *testing.T) {
&node.Argument{
Variadic: false,
IsReference: false,
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -118,8 +118,8 @@ func TestAssign(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Assign{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -139,8 +139,8 @@ func TestBitwiseAnd(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.BitwiseAnd{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -160,8 +160,8 @@ func TestBitwiseOr(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.BitwiseOr{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -181,8 +181,8 @@ func TestBitwiseXor(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.BitwiseXor{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -202,8 +202,8 @@ func TestConcat(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Concat{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -223,8 +223,8 @@ func TestDiv(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Div{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -244,8 +244,8 @@ func TestMinus(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Minus{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -265,8 +265,8 @@ func TestMod(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Mod{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -286,8 +286,8 @@ func TestMul(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Mul{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -307,8 +307,8 @@ func TestPlus(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Plus{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -328,8 +328,8 @@ func TestPow(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.Pow{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -349,8 +349,8 @@ func TestShiftLeft(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.ShiftLeft{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -370,8 +370,8 @@ func TestShiftRight(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign.ShiftRight{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},

View File

@ -20,112 +20,112 @@ var nodesToTest = []struct {
}{
{
&assign.AssignRef{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Variable", "Expression"},
map[string]interface{}{},
},
{
&assign.Assign{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Variable", "Expression"},
map[string]interface{}{},
},
{
&assign.BitwiseAnd{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Variable", "Expression"},
map[string]interface{}{},
},
{
&assign.BitwiseOr{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Variable", "Expression"},
map[string]interface{}{},
},
{
&assign.BitwiseXor{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Variable", "Expression"},
map[string]interface{}{},
},
{
&assign.Concat{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Variable", "Expression"},
map[string]interface{}{},
},
{
&assign.Div{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Variable", "Expression"},
map[string]interface{}{},
},
{
&assign.Minus{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Variable", "Expression"},
map[string]interface{}{},
},
{
&assign.Mod{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Variable", "Expression"},
map[string]interface{}{},
},
{
&assign.Mul{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Variable", "Expression"},
map[string]interface{}{},
},
{
&assign.Plus{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Variable", "Expression"},
map[string]interface{}{},
},
{
&assign.Pow{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Variable", "Expression"},
map[string]interface{}{},
},
{
&assign.ShiftLeft{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Variable", "Expression"},
map[string]interface{}{},
},
{
&assign.ShiftRight{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Variable", "Expression"},
map[string]interface{}{},

View File

@ -34,8 +34,8 @@ func TestBitwiseAnd(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.BitwiseAnd{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -55,8 +55,8 @@ func TestBitwiseOr(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.BitwiseOr{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -76,8 +76,8 @@ func TestBitwiseXor(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.BitwiseXor{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -97,8 +97,8 @@ func TestBooleanAnd(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.BooleanAnd{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -118,8 +118,8 @@ func TestBooleanOr(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.BooleanOr{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -139,8 +139,8 @@ func TestCoalesce(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Coalesce{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -157,8 +157,8 @@ func TestConcat(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Concat{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -178,8 +178,8 @@ func TestDiv(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Div{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -199,8 +199,8 @@ func TestEqual(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Equal{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -220,8 +220,8 @@ func TestGreaterOrEqual(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.GreaterOrEqual{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -241,8 +241,8 @@ func TestGreater(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Greater{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -262,8 +262,8 @@ func TestIdentical(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Identical{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -283,8 +283,8 @@ func TestLogicalAnd(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.LogicalAnd{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -304,8 +304,8 @@ func TestLogicalOr(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.LogicalOr{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -325,8 +325,8 @@ func TestLogicalXor(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.LogicalXor{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -346,8 +346,8 @@ func TestMinus(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Minus{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -367,8 +367,8 @@ func TestMod(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Mod{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -388,8 +388,8 @@ func TestMul(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Mul{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -409,8 +409,8 @@ func TestNotEqual(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.NotEqual{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -430,8 +430,8 @@ func TestNotIdentical(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.NotIdentical{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -451,8 +451,8 @@ func TestPlus(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Plus{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -472,8 +472,8 @@ func TestPow(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Pow{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -493,8 +493,8 @@ func TestShiftLeft(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.ShiftLeft{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -514,8 +514,8 @@ func TestShiftRight(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.ShiftRight{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -535,8 +535,8 @@ func TestSmallerOrEqual(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.SmallerOrEqual{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -556,8 +556,8 @@ func TestSmaller(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Smaller{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -577,8 +577,8 @@ func TestSpaceship(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &binary.Spaceship{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},

View File

@ -19,216 +19,216 @@ var nodesToTest = []struct {
}{
{
&binary.BitwiseAnd{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.BitwiseOr{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.BitwiseXor{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.BooleanAnd{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.BooleanOr{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.Coalesce{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.Concat{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.Div{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.Equal{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.GreaterOrEqual{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.Greater{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.Identical{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.LogicalAnd{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.LogicalOr{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.LogicalXor{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.Minus{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.Mod{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.Mul{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.NotEqual{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.NotIdentical{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.Plus{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.Pow{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.ShiftLeft{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.ShiftRight{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.SmallerOrEqual{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.Smaller{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},
},
{
&binary.Spaceship{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Right: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Left", "Right"},
map[string]interface{}{},

View File

@ -34,7 +34,7 @@ func TestCastArray(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.CastArray{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -54,7 +54,7 @@ func TestCastBool(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.CastBool{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -74,7 +74,7 @@ func TestCastBoolShort(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.CastBool{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -94,7 +94,7 @@ func TestCastDouble(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.CastDouble{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -114,7 +114,7 @@ func TestCastFloat(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.CastDouble{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -134,7 +134,7 @@ func TestCastInt(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.CastInt{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -154,7 +154,7 @@ func TestCastIntShort(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.CastInt{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -174,7 +174,7 @@ func TestCastObject(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.CastObject{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -194,7 +194,7 @@ func TestCastString(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.CastString{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -214,7 +214,7 @@ func TestCastUnset(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &cast.CastUnset{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},

View File

@ -19,49 +19,49 @@ var nodesToTest = []struct {
}{
{
&cast.CastArray{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&cast.CastBool{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&cast.CastDouble{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&cast.CastInt{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&cast.CastObject{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&cast.CastString{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&cast.CastUnset{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},

View File

@ -35,7 +35,7 @@ func TestArrayDimFetch(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.ArrayDimFetch{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Dim: &scalar.Lnumber{Value: "1"},
},
},
@ -57,7 +57,7 @@ func TestArrayDimFetchNested(t *testing.T) {
&stmt.Expression{
Expr: &expr.ArrayDimFetch{
Variable: &expr.ArrayDimFetch{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Dim: &scalar.Lnumber{Value: "1"},
},
Dim: &scalar.Lnumber{Value: "2"},

View File

@ -74,7 +74,7 @@ func TestArrayItems(t *testing.T) {
},
&expr.ArrayItem{
ByRef: true,
Val: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Val: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},

View File

@ -19,7 +19,7 @@ func TestBitwiseNot(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.BitwiseNot{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},

View File

@ -19,7 +19,7 @@ func TestBooleanNot(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.BooleanNot{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},

View File

@ -19,7 +19,7 @@ func TestCloneBrackets(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Clone{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -39,7 +39,7 @@ func TestClone(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Clone{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},

View File

@ -52,22 +52,22 @@ func TestClosureUse(t *testing.T) {
&node.Parameter{
ByRef: false,
Variadic: false,
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
&node.Parameter{
ByRef: false,
Variadic: false,
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
Uses: []node.Node{
&expr.ClosureUse{
ByRef: false,
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$c"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
},
&expr.ClosureUse{
ByRef: true,
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$d"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "d"}},
},
},
Stmts: []node.Node{},
@ -97,22 +97,22 @@ func TestClosureUse2(t *testing.T) {
&node.Parameter{
ByRef: false,
Variadic: false,
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
&node.Parameter{
ByRef: false,
Variadic: false,
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
Uses: []node.Node{
&expr.ClosureUse{
ByRef: true,
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$c"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
},
&expr.ClosureUse{
ByRef: false,
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$d"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "d"}},
},
},
Stmts: []node.Node{},

View File

@ -19,7 +19,7 @@ func TestEmpty(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Empty{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},

View File

@ -19,7 +19,7 @@ func TestErrorSuppress(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.ErrorSuppress{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},

View File

@ -19,7 +19,7 @@ func TestEval(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Eval{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},

View File

@ -37,7 +37,7 @@ func TestExitExpr(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Exit{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -75,7 +75,7 @@ func TestDieExpr(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Die{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},

View File

@ -104,13 +104,13 @@ func TestFunctionCallVar(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.FunctionCall{
Function: &expr.Variable{VarName: &node.Identifier{Value: "$foo"}},
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"}},
Value: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},

View File

@ -19,7 +19,7 @@ func TestPostDec(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.PostDec{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -39,7 +39,7 @@ func TestPostInc(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.PostInc{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -59,7 +59,7 @@ func TestPreDec(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.PreDec{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -79,7 +79,7 @@ func TestPreInc(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.PreInc{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},

View File

@ -19,7 +19,7 @@ func TestInclude(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Include{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -39,7 +39,7 @@ func TestIncludeOnce(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.IncludeOnce{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -59,7 +59,7 @@ func TestRequire(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Require{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -79,7 +79,7 @@ func TestRequireOnce(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.RequireOnce{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},

View File

@ -21,7 +21,7 @@ func TestInstanceOf(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.InstanceOf{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Class: &name.Name{
Parts: []node.Node{
&name.NamePart{Value: "Foo"},
@ -46,7 +46,7 @@ func TestInstanceOfRelative(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.InstanceOf{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Class: &name.Relative{
Parts: []node.Node{
&name.NamePart{Value: "Foo"},
@ -71,7 +71,7 @@ func TestInstanceOfFullyQualified(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.InstanceOf{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Class: &name.FullyQualified{
Parts: []node.Node{
&name.NamePart{Value: "Foo"},

View File

@ -20,7 +20,7 @@ func TestIsset(t *testing.T) {
&stmt.Expression{
Expr: &expr.Isset{
Variables: []node.Node{
&expr.Variable{VarName: &node.Identifier{Value: "$a"}},
&expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -42,8 +42,8 @@ func TestIssetVariables(t *testing.T) {
&stmt.Expression{
Expr: &expr.Isset{
Variables: []node.Node{
&expr.Variable{VarName: &node.Identifier{Value: "$a"}},
&expr.Variable{VarName: &node.Identifier{Value: "$b"}},
&expr.Variable{VarName: &node.Identifier{Value: "a"}},
&expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},

View File

@ -24,7 +24,7 @@ func TestEmptyList(t *testing.T) {
Variable: &expr.List{
Items: []node.Node{},
},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -48,11 +48,11 @@ func TestList(t *testing.T) {
Items: []node.Node{
&expr.ArrayItem{
ByRef: false,
Val: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -77,12 +77,12 @@ func TestListArrayIndex(t *testing.T) {
&expr.ArrayItem{
ByRef: false,
Val: &expr.ArrayDimFetch{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -110,14 +110,14 @@ func TestListList(t *testing.T) {
Items: []node.Node{
&expr.ArrayItem{
ByRef: false,
Val: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
},
},
},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},

View File

@ -19,7 +19,7 @@ func TestMethodCall(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.MethodCall{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Method: &node.Identifier{Value: "foo"},
Arguments: []node.Node{},
},

View File

@ -98,8 +98,8 @@ func TestNewAnonymous(t *testing.T) {
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"}}},
&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{},
},

View File

@ -19,7 +19,7 @@ func TestPrint(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Print{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},

View File

@ -19,7 +19,7 @@ func TestPropertyFetch(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.PropertyFetch{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Property: &node.Identifier{Value: "foo"},
},
},

View File

@ -23,7 +23,7 @@ func TestShellExec(t *testing.T) {
Expr: &expr.ShellExec{
Parts: []node.Node{
&scalar.EncapsedStringPart{Value: "cmd "},
&expr.Variable{VarName: &node.Identifier{Value: "$a"}},
&expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},

View File

@ -74,7 +74,7 @@ func TestShortArrayItems(t *testing.T) {
},
&expr.ArrayItem{
ByRef: true,
Val: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Val: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},

View File

@ -24,11 +24,11 @@ func TestShortList(t *testing.T) {
Items: []node.Node{
&expr.ArrayItem{
ByRef: false,
Val: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -50,12 +50,12 @@ func TestShortListArrayIndex(t *testing.T) {
&expr.ArrayItem{
ByRef: false,
Val: &expr.ArrayDimFetch{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -80,14 +80,14 @@ func TestShortListList(t *testing.T) {
Items: []node.Node{
&expr.ArrayItem{
ByRef: false,
Val: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Val: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
},
},
},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},

View File

@ -104,7 +104,7 @@ func TestStaticCallVar(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
Call: &expr.Variable{VarName: &node.Identifier{Value: "$bar"}},
Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
Arguments: []node.Node{},
},
},
@ -125,8 +125,8 @@ 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"}},
Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
Call: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
Arguments: []node.Node{},
},
},

View File

@ -25,7 +25,7 @@ func TestStaticPropertyFetch(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
Property: &expr.Variable{VarName: &node.Identifier{Value: "$bar"}},
Property: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
},
},
},
@ -50,7 +50,7 @@ func TestStaticPropertyFetchRelative(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
Property: &expr.Variable{VarName: &node.Identifier{Value: "$bar"}},
Property: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
},
},
},
@ -75,7 +75,7 @@ func TestStaticPropertyFetchFullyQualified(t *testing.T) {
&name.NamePart{Value: "Foo"},
},
},
Property: &expr.Variable{VarName: &node.Identifier{Value: "$bar"}},
Property: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
},
},
},

View File

@ -19,9 +19,9 @@ func TestTernary(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Ternary{
Condition: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
IfTrue: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
IfFalse: &expr.Variable{VarName: &node.Identifier{Value: "$c"}},
Condition: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
IfTrue: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
IfFalse: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
},
},
},
@ -41,8 +41,8 @@ func TestTernarySimple(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Ternary{
Condition: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
IfFalse: &expr.Variable{VarName: &node.Identifier{Value: "$c"}},
Condition: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
IfFalse: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
},
},
},
@ -62,13 +62,13 @@ func TestTernaryNestedTrue(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Ternary{
Condition: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Condition: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
IfTrue: &expr.Ternary{
Condition: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
IfTrue: &expr.Variable{VarName: &node.Identifier{Value: "$c"}},
IfFalse: &expr.Variable{VarName: &node.Identifier{Value: "$d"}},
Condition: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
IfTrue: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
IfFalse: &expr.Variable{VarName: &node.Identifier{Value: "d"}},
},
IfFalse: &expr.Variable{VarName: &node.Identifier{Value: "$e"}},
IfFalse: &expr.Variable{VarName: &node.Identifier{Value: "e"}},
},
},
},
@ -89,12 +89,12 @@ func TestTernaryNestedCond(t *testing.T) {
&stmt.Expression{
Expr: &expr.Ternary{
Condition: &expr.Ternary{
Condition: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
IfTrue: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
IfFalse: &expr.Variable{VarName: &node.Identifier{Value: "$c"}},
Condition: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
IfTrue: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
IfFalse: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
},
IfTrue: &expr.Variable{VarName: &node.Identifier{Value: "$d"}},
IfFalse: &expr.Variable{VarName: &node.Identifier{Value: "$e"}},
IfTrue: &expr.Variable{VarName: &node.Identifier{Value: "d"}},
IfFalse: &expr.Variable{VarName: &node.Identifier{Value: "e"}},
},
},
},

View File

@ -19,7 +19,7 @@ func TestUnaryMinus(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.UnaryMinus{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -39,7 +39,7 @@ func TestUnaryPlus(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.UnaryPlus{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},

View File

@ -18,7 +18,7 @@ func TestVariable(t *testing.T) {
expected := &stmt.StmtList{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
}
@ -36,7 +36,7 @@ func TestVariableVariable(t *testing.T) {
expected := &stmt.StmtList{
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Variable{VarName: &expr.Variable{VarName: &node.Identifier{Value: "$a"}}},
Expr: &expr.Variable{VarName: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
},
},
}

View File

@ -24,7 +24,7 @@ var nodesToTest = []struct {
}{
{
&expr.ArrayDimFetch{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Dim: &scalar.Lnumber{Value: "1"},
},
[]string{"Variable", "Dim"},
@ -54,21 +54,21 @@ var nodesToTest = []struct {
},
{
&expr.BitwiseNot{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&expr.BooleanNot{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&expr.ClassConstFetch{
Class: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Class: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
ConstantName: &node.Identifier{Value: "foo"},
},
[]string{"Class", "ConstantName"},
@ -76,7 +76,7 @@ var nodesToTest = []struct {
},
{
&expr.Clone{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
@ -84,7 +84,7 @@ var nodesToTest = []struct {
{
&expr.ClosureUse{
ByRef: false,
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Variable"},
map[string]interface{}{"ByRef": false},
@ -111,42 +111,42 @@ var nodesToTest = []struct {
},
{
&expr.Empty{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&expr.ErrorSuppress{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&expr.Eval{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&expr.Exit{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&expr.Die{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&expr.FunctionCall{
Function: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Function: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Arguments: []node.Node{&node.Argument{}},
},
[]string{"Function", "Arguments"},
@ -154,21 +154,21 @@ var nodesToTest = []struct {
},
{
&expr.IncludeOnce{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&expr.Include{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&expr.InstanceOf{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Class: &name.Name{},
},
[]string{"Expr", "Class"},
@ -177,7 +177,7 @@ var nodesToTest = []struct {
{
&expr.Isset{
Variables: []node.Node{
&expr.Variable{VarName: &node.Identifier{Value: "$a"}},
&expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
[]string{"Variables"},
@ -194,7 +194,7 @@ var nodesToTest = []struct {
},
{
&expr.MethodCall{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Method: &node.Identifier{Value: "foo"},
Arguments: []node.Node{&node.Argument{}},
},
@ -211,42 +211,42 @@ var nodesToTest = []struct {
},
{
&expr.PostDec{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Variable"},
map[string]interface{}{},
},
{
&expr.PostInc{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Variable"},
map[string]interface{}{},
},
{
&expr.PreDec{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Variable"},
map[string]interface{}{},
},
{
&expr.PreInc{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Variable"},
map[string]interface{}{},
},
{
&expr.Print{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&expr.PropertyFetch{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Property: &node.Identifier{Value: "foo"},
},
[]string{"Variable", "Property"},
@ -254,14 +254,14 @@ var nodesToTest = []struct {
},
{
&expr.RequireOnce{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&expr.Require{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
@ -312,43 +312,43 @@ var nodesToTest = []struct {
},
{
&expr.Ternary{
Condition: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
IfTrue: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
IfFalse: &expr.Variable{VarName: &node.Identifier{Value: "$c"}},
Condition: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
IfTrue: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
IfFalse: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
},
[]string{"Condition", "IfTrue", "IfFalse"},
map[string]interface{}{},
},
{
&expr.UnaryMinus{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&expr.UnaryPlus{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&expr.Variable{VarName: &node.Identifier{Value: "$a"}},
&expr.Variable{VarName: &node.Identifier{Value: "a"}},
[]string{"VarName"},
map[string]interface{}{},
},
{
&expr.YieldFrom{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
[]string{"Expr"},
map[string]interface{}{},
},
{
&expr.Yield{
Key: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Value: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Key: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Value: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
[]string{"Key", "Value"},
map[string]interface{}{},

View File

@ -38,7 +38,7 @@ func TestYieldVal(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Yield{
Value: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Value: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -58,8 +58,8 @@ func TestYieldKeyVal(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Yield{
Key: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Value: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Key: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Value: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -99,7 +99,7 @@ func TestYieldKeyExpr(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Yield{
Key: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Key: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Value: &scalar.Lnumber{Value: "1"},
},
},
@ -120,7 +120,7 @@ func TestYieldFrom(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.YieldFrom{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},

View File

@ -22,7 +22,7 @@ func TestSimpleVar(t *testing.T) {
Expr: &scalar.Encapsed{
Parts: []node.Node{
&scalar.EncapsedStringPart{Value: "test "},
&expr.Variable{VarName: &node.Identifier{Value: "$var"}},
&expr.Variable{VarName: &node.Identifier{Value: "var"}},
},
},
},
@ -46,7 +46,7 @@ func TestSimpleVarPropertyFetch(t *testing.T) {
Parts: []node.Node{
&scalar.EncapsedStringPart{Value: "test "},
&expr.PropertyFetch{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$foo"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
Property: &node.Identifier{Value: "bar"},
},
&scalar.EncapsedStringPart{Value: "()"},
@ -122,7 +122,7 @@ func TestCurlyOpenMethodCall(t *testing.T) {
Parts: []node.Node{
&scalar.EncapsedStringPart{Value: "test "},
&expr.MethodCall{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$foo"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
Method: &node.Identifier{Value: "bar"},
Arguments: []node.Node{},
},

View File

@ -36,7 +36,7 @@ func TestAltIf(t *testing.T) {
expected := &stmt.StmtList{
Stmts: []node.Node{
&stmt.AltIf{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
},
@ -59,11 +59,11 @@ func TestAltElseIf(t *testing.T) {
expected := &stmt.StmtList{
Stmts: []node.Node{
&stmt.AltIf{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
ElseIf: []node.Node{
&stmt.AltElseIf{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Cond: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
},
@ -88,7 +88,7 @@ func TestAltElse(t *testing.T) {
expected := &stmt.StmtList{
Stmts: []node.Node{
&stmt.AltIf{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
Else: &stmt.AltElse{
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
@ -116,15 +116,15 @@ func TestAltElseElseIf(t *testing.T) {
expected := &stmt.StmtList{
Stmts: []node.Node{
&stmt.AltIf{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
ElseIf: []node.Node{
&stmt.AltElseIf{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Cond: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
&stmt.AltElseIf{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "$c"}},
Cond: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
},

View File

@ -22,7 +22,7 @@ func TestSimpleEcho(t *testing.T) {
&stmt.Echo{
Exprs: []node.Node{
&expr.Variable{
VarName: &node.Identifier{Value: "$a"},
VarName: &node.Identifier{Value: "a"},
},
&scalar.Lnumber{Value: "1"},
},
@ -45,7 +45,7 @@ func TestEcho(t *testing.T) {
&stmt.Echo{
Exprs: []node.Node{
&expr.Variable{
VarName: &node.Identifier{Value: "$a"},
VarName: &node.Identifier{Value: "a"},
},
},
},

View File

@ -25,22 +25,22 @@ func TestFor(t *testing.T) {
&stmt.For{
Init: []node.Node{
&assign.Assign{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$i"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "i"}},
Expression: &scalar.Lnumber{Value: "0"},
},
},
Cond: []node.Node{
&binary.Smaller{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$i"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "i"}},
Right: &scalar.Lnumber{Value: "10"},
},
},
Loop: []node.Node{
&expr.PostInc{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$i"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "i"}},
},
&expr.PostInc{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$i"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "i"}},
},
},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
@ -63,13 +63,13 @@ func TestAltFor(t *testing.T) {
&stmt.AltFor{
Cond: []node.Node{
&binary.Smaller{
Left: &expr.Variable{VarName: &node.Identifier{Value: "$i"}},
Left: &expr.Variable{VarName: &node.Identifier{Value: "i"}},
Right: &scalar.Lnumber{Value: "10"},
},
},
Loop: []node.Node{
&expr.PostInc{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$i"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "i"}},
},
},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},

View File

@ -18,8 +18,8 @@ func TestForeach(t *testing.T) {
expected := &stmt.StmtList{
Stmts: []node.Node{
&stmt.Foreach{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$v"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
},
@ -39,7 +39,7 @@ func TestForeachExpr(t *testing.T) {
Stmts: []node.Node{
&stmt.Foreach{
Expr: &expr.ShortArray{Items: []node.Node{}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$v"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
},
@ -58,8 +58,8 @@ func TestAltForeach(t *testing.T) {
expected := &stmt.StmtList{
Stmts: []node.Node{
&stmt.AltForeach{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$v"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
},
@ -78,9 +78,9 @@ func TestForeachWithKey(t *testing.T) {
expected := &stmt.StmtList{
Stmts: []node.Node{
&stmt.Foreach{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Key: &expr.Variable{VarName: &node.Identifier{Value: "$k"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$v"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
},
@ -100,8 +100,8 @@ func TestForeachExprWithKey(t *testing.T) {
Stmts: []node.Node{
&stmt.Foreach{
Expr: &expr.ShortArray{Items: []node.Node{}},
Key: &expr.Variable{VarName: &node.Identifier{Value: "$k"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$v"}},
Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
},
@ -121,9 +121,9 @@ func TestForeachWithRef(t *testing.T) {
Stmts: []node.Node{
&stmt.Foreach{
ByRef: true,
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Key: &expr.Variable{VarName: &node.Identifier{Value: "$k"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$v"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
},
@ -143,13 +143,13 @@ func TestForeachWithList(t *testing.T) {
Stmts: []node.Node{
&stmt.Foreach{
ByRef: false,
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Key: &expr.Variable{VarName: &node.Identifier{Value: "$k"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Key: &expr.Variable{VarName: &node.Identifier{Value: "k"}},
Variable: &expr.List{
Items: []node.Node{
&expr.ArrayItem{
ByRef: false,
Val: &expr.Variable{VarName: &node.Identifier{Value: "$v"}},
Val: &expr.Variable{VarName: &node.Identifier{Value: "v"}},
},
},
},

View File

@ -72,18 +72,18 @@ func TestFunctionReturnVar(t *testing.T) {
ByRef: false,
Variadic: false,
VariableType: &node.Identifier{Value: "array"},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
&node.Parameter{
ByRef: false,
Variadic: false,
VariableType: &node.Identifier{Value: "callable"},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
Stmts: []node.Node{
&stmt.Return{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},

View File

@ -19,7 +19,7 @@ func TestGlobal(t *testing.T) {
Stmts: []node.Node{
&stmt.Global{
Vars: []node.Node{
&expr.Variable{VarName: &node.Identifier{Value: "$a"}},
&expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -39,9 +39,9 @@ func TestGlobalVars(t *testing.T) {
Stmts: []node.Node{
&stmt.Global{
Vars: []node.Node{
&expr.Variable{VarName: &node.Identifier{Value: "$a"}},
&expr.Variable{VarName: &node.Identifier{Value: "$b"}},
&expr.Variable{VarName: &expr.Variable{VarName: &node.Identifier{Value: "$c"}}},
&expr.Variable{VarName: &node.Identifier{Value: "a"}},
&expr.Variable{VarName: &node.Identifier{Value: "b"}},
&expr.Variable{VarName: &expr.Variable{VarName: &node.Identifier{Value: "c"}}},
&expr.Variable{
VarName: &expr.FunctionCall{
Function: &name.Name{

View File

@ -18,7 +18,7 @@ func TestIf(t *testing.T) {
expected := &stmt.StmtList{
Stmts: []node.Node{
&stmt.If{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
},
@ -38,11 +38,11 @@ func TestElseIf(t *testing.T) {
expected := &stmt.StmtList{
Stmts: []node.Node{
&stmt.If{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
ElseIf: []node.Node{
&stmt.ElseIf{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Cond: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
},
@ -63,7 +63,7 @@ func TestElse(t *testing.T) {
expected := &stmt.StmtList{
Stmts: []node.Node{
&stmt.If{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
Else: &stmt.Else{
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
@ -85,15 +85,15 @@ func TestElseElseIf(t *testing.T) {
expected := &stmt.StmtList{
Stmts: []node.Node{
&stmt.If{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
ElseIf: []node.Node{
&stmt.ElseIf{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Cond: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
&stmt.ElseIf{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "$c"}},
Cond: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
},
@ -117,17 +117,17 @@ func TestElseIfElseIfElse(t *testing.T) {
expected := &stmt.StmtList{
Stmts: []node.Node{
&stmt.If{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
ElseIf: []node.Node{
&stmt.ElseIf{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Cond: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
},
},
Else: &stmt.Else{
Stmt: &stmt.If{
Cond: &expr.Variable{VarName: &node.Identifier{Value: "$c"}},
Cond: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
Else: &stmt.Else{
Stmt: &stmt.StmtList{Stmts: []node.Node{}},

View File

@ -27,7 +27,7 @@ func TestProperty(t *testing.T) {
Properties: []node.Node{
&stmt.Property{
PhpDocComment: "",
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -59,11 +59,11 @@ func TestProperties(t *testing.T) {
Properties: []node.Node{
&stmt.Property{
PhpDocComment: "",
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
&stmt.Property{
PhpDocComment: "",
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
Expr: &scalar.Lnumber{Value: "1"},
},
},
@ -96,12 +96,12 @@ func TestProperties2(t *testing.T) {
Properties: []node.Node{
&stmt.Property{
PhpDocComment: "",
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expr: &scalar.Lnumber{Value: "1"},
},
&stmt.Property{
PhpDocComment: "",
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},

View File

@ -20,7 +20,7 @@ func TestStaticVar(t *testing.T) {
&stmt.Static{
Vars: []node.Node{
&stmt.StaticVar{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -42,10 +42,10 @@ func TestStaticVars(t *testing.T) {
&stmt.Static{
Vars: []node.Node{
&stmt.StaticVar{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
&stmt.StaticVar{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
Expr: &scalar.Lnumber{Value: "1"},
},
},
@ -68,11 +68,11 @@ func TestStaticVars2(t *testing.T) {
&stmt.Static{
Vars: []node.Node{
&stmt.StaticVar{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
Expr: &scalar.Lnumber{Value: "1"},
},
&stmt.StaticVar{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},

View File

@ -17,7 +17,7 @@ func TestThrow(t *testing.T) {
expected := &stmt.StmtList{
Stmts: []node.Node{
&stmt.Throw{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$e"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "e"}},
},
},
}

View File

@ -52,7 +52,7 @@ func TestTryCatch(t *testing.T) {
},
},
Variable: &expr.Variable{
VarName: &node.Identifier{Value: "$e"},
VarName: &node.Identifier{Value: "e"},
},
Stmts: []node.Node{},
},
@ -92,7 +92,7 @@ func TestPhp7TryCatch(t *testing.T) {
},
},
Variable: &expr.Variable{
VarName: &node.Identifier{Value: "$e"},
VarName: &node.Identifier{Value: "e"},
},
Stmts: []node.Node{},
},
@ -124,7 +124,7 @@ func TestTryCatchCatch(t *testing.T) {
},
},
Variable: &expr.Variable{
VarName: &node.Identifier{Value: "$e"},
VarName: &node.Identifier{Value: "e"},
},
Stmts: []node.Node{},
},
@ -137,7 +137,7 @@ func TestTryCatchCatch(t *testing.T) {
},
},
Variable: &expr.Variable{
VarName: &node.Identifier{Value: "$e"},
VarName: &node.Identifier{Value: "e"},
},
Stmts: []node.Node{},
},
@ -172,7 +172,7 @@ func TestTryCatchFinally(t *testing.T) {
},
},
Variable: &expr.Variable{
VarName: &node.Identifier{Value: "$e"},
VarName: &node.Identifier{Value: "e"},
},
Stmts: []node.Node{},
},
@ -208,7 +208,7 @@ func TestTryCatchCatchCatch(t *testing.T) {
},
},
Variable: &expr.Variable{
VarName: &node.Identifier{Value: "$e"},
VarName: &node.Identifier{Value: "e"},
},
Stmts: []node.Node{},
},
@ -221,7 +221,7 @@ func TestTryCatchCatchCatch(t *testing.T) {
},
},
Variable: &expr.Variable{
VarName: &node.Identifier{Value: "$e"},
VarName: &node.Identifier{Value: "e"},
},
Stmts: []node.Node{},
},
@ -234,7 +234,7 @@ func TestTryCatchCatchCatch(t *testing.T) {
},
},
Variable: &expr.Variable{
VarName: &node.Identifier{Value: "$e"},
VarName: &node.Identifier{Value: "e"},
},
Stmts: []node.Node{},
},

View File

@ -18,7 +18,7 @@ func TestUnset(t *testing.T) {
Stmts: []node.Node{
&stmt.Unset{
Vars: []node.Node{
&expr.Variable{VarName: &node.Identifier{Value: "$a"}},
&expr.Variable{VarName: &node.Identifier{Value: "a"}},
},
},
},
@ -38,8 +38,8 @@ func TestUnsetVars(t *testing.T) {
Stmts: []node.Node{
&stmt.Unset{
Vars: []node.Node{
&expr.Variable{VarName: &node.Identifier{Value: "$a"}},
&expr.Variable{VarName: &node.Identifier{Value: "$b"}},
&expr.Variable{VarName: &node.Identifier{Value: "a"}},
&expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},
@ -59,8 +59,8 @@ func TestUnsetTrailingComma(t *testing.T) {
Stmts: []node.Node{
&stmt.Unset{
Vars: []node.Node{
&expr.Variable{VarName: &node.Identifier{Value: "$a"}},
&expr.Variable{VarName: &node.Identifier{Value: "$b"}},
&expr.Variable{VarName: &node.Identifier{Value: "a"}},
&expr.Variable{VarName: &node.Identifier{Value: "b"}},
},
},
},

View File

@ -36,7 +36,7 @@ func TestIdentifier(t *testing.T) {
Stmts: []node.Node{
&stmt.Expression{
Expr: &expr.Variable{
VarName: &node.Identifier{Value: "$foo"},
VarName: &node.Identifier{Value: "foo"},
},
},
},
@ -67,27 +67,27 @@ func TestPhp7ArgumentNode(t *testing.T) {
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"}}},
&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"}},
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"}}},
&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.MethodCall{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$foo"}},
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"}}},
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
},
},
},
@ -96,18 +96,18 @@ func TestPhp7ArgumentNode(t *testing.T) {
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"}}},
&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.StaticCall{
Class: &expr.Variable{VarName: &node.Identifier{Value: "$foo"}},
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"}}},
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
},
},
},
@ -115,8 +115,8 @@ func TestPhp7ArgumentNode(t *testing.T) {
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"}}},
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
},
},
},
@ -125,8 +125,8 @@ func TestPhp7ArgumentNode(t *testing.T) {
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"}}},
&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{},
},
@ -155,27 +155,27 @@ func TestPhp5ArgumentNode(t *testing.T) {
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"}}},
&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"}},
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"}}},
&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.MethodCall{
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$foo"}},
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"}}},
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
},
},
},
@ -184,18 +184,18 @@ func TestPhp5ArgumentNode(t *testing.T) {
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"}}},
&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.StaticCall{
Class: &expr.Variable{VarName: &node.Identifier{Value: "$foo"}},
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"}}},
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
},
},
},
@ -203,8 +203,8 @@ func TestPhp5ArgumentNode(t *testing.T) {
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"}}},
&node.Argument{Variadic: false, Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}}},
&node.Argument{Variadic: true, Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}}},
},
},
},
@ -228,14 +228,14 @@ func TestPhp7ParameterNode(t *testing.T) {
ByRef: false,
Variadic: false,
VariableType: &node.Nullable{Expr: &name.Name{Parts: []node.Node{&name.NamePart{Value: "bar"}}}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$bar"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
DefaultValue: &expr.ConstFetch{Constant: &name.Name{Parts: []node.Node{&name.NamePart{Value: "null"}}}},
},
&node.Parameter{
ByRef: true,
Variadic: true,
VariableType: &name.Name{Parts: []node.Node{&name.NamePart{Value: "baz"}}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$baz"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "baz"}},
},
}
@ -294,14 +294,14 @@ func TestPhp5ParameterNode(t *testing.T) {
ByRef: false,
Variadic: false,
VariableType: &name.Name{Parts: []node.Node{&name.NamePart{Value: "bar"}}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$bar"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
DefaultValue: &expr.ConstFetch{Constant: &name.Name{Parts: []node.Node{&name.NamePart{Value: "null"}}}},
},
&node.Parameter{
ByRef: true,
Variadic: true,
VariableType: &name.Name{Parts: []node.Node{&name.NamePart{Value: "baz"}}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$baz"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "baz"}},
},
}

View File

@ -2943,7 +2943,7 @@ yydefault:
yyDollar = yyS[yypt-9 : yypt+1]
//line php5/php5.y:806
{
identifier := node.NewIdentifier(yyDollar[4].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[4].token))
comments.AddComments(identifier, yyDollar[4].token.Comments())
@ -2999,7 +2999,7 @@ yydefault:
yyDollar = yyS[yypt-8 : yypt+1]
//line php5/php5.y:849
{
identifier := node.NewIdentifier(yyDollar[4].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[4].token))
comments.AddComments(identifier, yyDollar[4].token.Comments())
@ -3462,7 +3462,7 @@ yydefault:
yyDollar = yyS[yypt-4 : yypt+1]
//line php5/php5.y:1223
{
identifier := node.NewIdentifier(yyDollar[4].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[4].token))
comments.AddComments(yyVAL.node, yyDollar[4].token.Comments())
@ -3490,7 +3490,7 @@ yydefault:
yyDollar = yyS[yypt-6 : yypt+1]
//line php5/php5.y:1249
{
identifier := node.NewIdentifier(yyDollar[4].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[4].token))
comments.AddComments(identifier, yyDollar[4].token.Comments())
@ -3624,7 +3624,7 @@ yydefault:
yyDollar = yyS[yypt-1 : yypt+1]
//line php5/php5.y:1357
{
name := node.NewIdentifier(yyDollar[1].token.Value)
name := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(name, positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = expr.NewVariable(name)
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenPosition(yyDollar[1].token))
@ -3652,7 +3652,7 @@ yydefault:
yyDollar = yyS[yypt-3 : yypt+1]
//line php5/php5.y:1383
{
identifier := node.NewIdentifier(yyDollar[3].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[3].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[3].token))
variable := expr.NewVariable(identifier)
@ -3671,7 +3671,7 @@ yydefault:
yyDollar = yyS[yypt-5 : yypt+1]
//line php5/php5.y:1400
{
identifier := node.NewIdentifier(yyDollar[3].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[3].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[3].token))
variable := expr.NewVariable(identifier)
@ -3690,7 +3690,7 @@ yydefault:
yyDollar = yyS[yypt-1 : yypt+1]
//line php5/php5.y:1417
{
identifier := node.NewIdentifier(yyDollar[1].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
@ -3709,7 +3709,7 @@ yydefault:
yyDollar = yyS[yypt-3 : yypt+1]
//line php5/php5.y:1434
{
identifier := node.NewIdentifier(yyDollar[1].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
@ -4022,7 +4022,7 @@ yydefault:
yyDollar = yyS[yypt-3 : yypt+1]
//line php5/php5.y:1674
{
identifier := node.NewIdentifier(yyDollar[3].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[3].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[3].token))
comments.AddComments(identifier, yyDollar[3].token.Comments())
@ -4040,7 +4040,7 @@ yydefault:
yyDollar = yyS[yypt-5 : yypt+1]
//line php5/php5.y:1690
{
identifier := node.NewIdentifier(yyDollar[3].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[3].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[3].token))
comments.AddComments(identifier, yyDollar[3].token.Comments())
@ -4058,7 +4058,7 @@ yydefault:
yyDollar = yyS[yypt-1 : yypt+1]
//line php5/php5.y:1706
{
identifier := node.NewIdentifier(yyDollar[1].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[1].token))
comments.AddComments(identifier, yyDollar[1].token.Comments())
@ -4076,7 +4076,7 @@ yydefault:
yyDollar = yyS[yypt-3 : yypt+1]
//line php5/php5.y:1722
{
identifier := node.NewIdentifier(yyDollar[1].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[1].token))
comments.AddComments(identifier, yyDollar[1].token.Comments())
@ -4958,7 +4958,7 @@ yydefault:
yyDollar = yyS[yypt-3 : yypt+1]
//line php5/php5.y:2397
{
identifier := node.NewIdentifier(yyDollar[3].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[3].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[3].token))
comments.AddComments(identifier, yyDollar[3].token.Comments())
@ -4976,7 +4976,7 @@ yydefault:
yyDollar = yyS[yypt-4 : yypt+1]
//line php5/php5.y:2413
{
identifier := node.NewIdentifier(yyDollar[4].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[4].token))
comments.AddComments(identifier, yyDollar[4].token.Comments())
@ -4994,7 +4994,7 @@ yydefault:
yyDollar = yyS[yypt-1 : yypt+1]
//line php5/php5.y:2429
{
identifier := node.NewIdentifier(yyDollar[1].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[1].token))
comments.AddComments(identifier, yyDollar[1].token.Comments())
@ -5012,7 +5012,7 @@ yydefault:
yyDollar = yyS[yypt-2 : yypt+1]
//line php5/php5.y:2445
{
identifier := node.NewIdentifier(yyDollar[2].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[2].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[2].token))
comments.AddComments(identifier, yyDollar[2].token.Comments())
@ -6181,7 +6181,7 @@ yydefault:
yyDollar = yyS[yypt-1 : yypt+1]
//line php5/php5.y:3365
{
name := node.NewIdentifier(yyDollar[1].token.Value)
name := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(name, positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = expr.NewVariable(name)
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenPosition(yyDollar[1].token))
@ -6457,7 +6457,7 @@ yydefault:
yyDollar = yyS[yypt-1 : yypt+1]
//line php5/php5.y:3593
{
name := node.NewIdentifier(yyDollar[1].token.Value)
name := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(name, positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = expr.NewVariable(name)
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenPosition(yyDollar[1].token))
@ -6469,7 +6469,7 @@ yydefault:
yyDollar = yyS[yypt-4 : yypt+1]
//line php5/php5.y:3603
{
identifier := node.NewIdentifier(yyDollar[1].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition(yyDollar[1].token))
@ -6484,7 +6484,7 @@ yydefault:
yyDollar = yyS[yypt-3 : yypt+1]
//line php5/php5.y:3616
{
identifier := node.NewIdentifier(yyDollar[1].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition(yyDollar[1].token))
@ -6553,7 +6553,7 @@ yydefault:
yyDollar = yyS[yypt-1 : yypt+1]
//line php5/php5.y:3675
{
identifier := node.NewIdentifier(yyDollar[1].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = expr.NewVariable(identifier)
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenPosition(yyDollar[1].token))

View File

@ -804,7 +804,7 @@ catch_statement:
{ $$ = []node.Node{} }
| T_CATCH '(' fully_qualified_class_name T_VARIABLE ')' '{' inner_statement_list '}' additional_catches
{
identifier := node.NewIdentifier($4.Value)
identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($4))
comments.AddComments(identifier, $4.Comments())
@ -847,7 +847,7 @@ non_empty_additional_catches:
additional_catch:
T_CATCH '(' fully_qualified_class_name T_VARIABLE ')' '{' inner_statement_list '}'
{
identifier := node.NewIdentifier($4.Value)
identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($4))
comments.AddComments(identifier, $4.Comments())
@ -1221,7 +1221,7 @@ non_empty_parameter_list:
parameter:
optional_class_type is_reference is_variadic T_VARIABLE
{
identifier := node.NewIdentifier($4.Value)
identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($4))
comments.AddComments($$, $4.Comments())
@ -1247,7 +1247,7 @@ parameter:
}
| optional_class_type is_reference is_variadic T_VARIABLE '=' static_scalar
{
identifier := node.NewIdentifier($4.Value)
identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($4))
comments.AddComments(identifier, $4.Comments())
@ -1355,7 +1355,7 @@ global_var_list:
global_var:
T_VARIABLE
{
name := node.NewIdentifier($1.Value)
name := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(name, positionBuilder.NewTokenPosition($1))
$$ = expr.NewVariable(name)
positions.AddPosition($$, positionBuilder.NewTokenPosition($1))
@ -1381,7 +1381,7 @@ global_var:
static_var_list:
static_var_list ',' T_VARIABLE
{
identifier := node.NewIdentifier($3.Value)
identifier := node.NewIdentifier(strings.TrimLeft($3.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($3))
variable := expr.NewVariable(identifier)
@ -1398,7 +1398,7 @@ static_var_list:
}
| static_var_list ',' T_VARIABLE '=' static_scalar
{
identifier := node.NewIdentifier($3.Value)
identifier := node.NewIdentifier(strings.TrimLeft($3.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($3))
variable := expr.NewVariable(identifier)
@ -1415,7 +1415,7 @@ static_var_list:
}
| T_VARIABLE
{
identifier := node.NewIdentifier($1.Value)
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($1))
variable := expr.NewVariable(identifier)
@ -1432,7 +1432,7 @@ static_var_list:
}
| T_VARIABLE '=' static_scalar
{
identifier := node.NewIdentifier($1.Value)
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($1))
variable := expr.NewVariable(identifier)
@ -1672,7 +1672,7 @@ member_modifier:
class_variable_declaration:
class_variable_declaration ',' T_VARIABLE
{
identifier := node.NewIdentifier($3.Value)
identifier := node.NewIdentifier(strings.TrimLeft($3.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($3))
comments.AddComments(identifier, $3.Comments())
@ -1688,7 +1688,7 @@ class_variable_declaration:
}
| class_variable_declaration ',' T_VARIABLE '=' static_scalar
{
identifier := node.NewIdentifier($3.Value)
identifier := node.NewIdentifier(strings.TrimLeft($3.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($3))
comments.AddComments(identifier, $3.Comments())
@ -1704,7 +1704,7 @@ class_variable_declaration:
}
| T_VARIABLE
{
identifier := node.NewIdentifier($1.Value)
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($1))
comments.AddComments(identifier, $1.Comments())
@ -1720,7 +1720,7 @@ class_variable_declaration:
}
| T_VARIABLE '=' static_scalar
{
identifier := node.NewIdentifier($1.Value)
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($1))
comments.AddComments(identifier, $1.Comments())
@ -2395,7 +2395,7 @@ lexical_vars:
lexical_var_list:
lexical_var_list ',' T_VARIABLE
{
identifier := node.NewIdentifier($3.Value)
identifier := node.NewIdentifier(strings.TrimLeft($3.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($3))
comments.AddComments(identifier, $3.Comments())
@ -2411,7 +2411,7 @@ lexical_var_list:
}
| lexical_var_list ',' '&' T_VARIABLE
{
identifier := node.NewIdentifier($4.Value)
identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($4))
comments.AddComments(identifier, $4.Comments())
@ -2427,7 +2427,7 @@ lexical_var_list:
}
| T_VARIABLE
{
identifier := node.NewIdentifier($1.Value)
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($1))
comments.AddComments(identifier, $1.Comments())
@ -2443,7 +2443,7 @@ lexical_var_list:
}
| '&' T_VARIABLE
{
identifier := node.NewIdentifier($2.Value)
identifier := node.NewIdentifier(strings.TrimLeft($2.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($2))
comments.AddComments(identifier, $2.Comments())
@ -3364,7 +3364,7 @@ reference_variable:
compound_variable:
T_VARIABLE
{
name := node.NewIdentifier($1.Value)
name := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(name, positionBuilder.NewTokenPosition($1))
$$ = expr.NewVariable(name)
positions.AddPosition($$, positionBuilder.NewTokenPosition($1))
@ -3592,7 +3592,7 @@ encaps_list:
encaps_var:
T_VARIABLE
{
name := node.NewIdentifier($1.Value)
name := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(name, positionBuilder.NewTokenPosition($1))
$$ = expr.NewVariable(name)
positions.AddPosition($$, positionBuilder.NewTokenPosition($1))
@ -3602,7 +3602,7 @@ encaps_var:
}
| T_VARIABLE '[' encaps_var_offset ']'
{
identifier := node.NewIdentifier($1.Value)
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($1))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition($1))
@ -3615,7 +3615,7 @@ encaps_var:
}
| T_VARIABLE T_OBJECT_OPERATOR T_STRING
{
identifier := node.NewIdentifier($1.Value)
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($1))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition($1))
@ -3674,7 +3674,7 @@ encaps_var_offset:
}
| T_VARIABLE
{
identifier := node.NewIdentifier($1.Value)
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($1))
$$ = expr.NewVariable(identifier)
positions.AddPosition($$, positionBuilder.NewTokenPosition($1))

File diff suppressed because it is too large Load Diff

View File

@ -3089,7 +3089,7 @@ yydefault:
yyDollar = yyS[yypt-9 : yypt+1]
//line php7/php7.y:691
{
identifier := node.NewIdentifier(yyDollar[5].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[5].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[5].token))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition(yyDollar[5].token))
@ -3534,7 +3534,7 @@ yydefault:
yyDollar = yyS[yypt-4 : yypt+1]
//line php7/php7.y:1012
{
identifier := node.NewIdentifier(yyDollar[4].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[4].token))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition(yyDollar[4].token))
@ -3564,7 +3564,7 @@ yydefault:
yyDollar = yyS[yypt-6 : yypt+1]
//line php7/php7.y:1040
{
identifier := node.NewIdentifier(yyDollar[4].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[4].token))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition(yyDollar[4].token))
@ -3724,7 +3724,7 @@ yydefault:
yyDollar = yyS[yypt-1 : yypt+1]
//line php7/php7.y:1146
{
identifier := node.NewIdentifier(yyDollar[1].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition(yyDollar[1].token))
@ -3739,7 +3739,7 @@ yydefault:
yyDollar = yyS[yypt-3 : yypt+1]
//line php7/php7.y:1159
{
identifier := node.NewIdentifier(yyDollar[1].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition(yyDollar[1].token))
@ -4049,7 +4049,7 @@ yydefault:
yyDollar = yyS[yypt-2 : yypt+1]
//line php7/php7.y:1377
{
identifier := node.NewIdentifier(yyDollar[1].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition(yyDollar[1].token))
@ -4064,7 +4064,7 @@ yydefault:
yyDollar = yyS[yypt-4 : yypt+1]
//line php7/php7.y:1390
{
identifier := node.NewIdentifier(yyDollar[1].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition(yyDollar[1].token))
@ -4848,7 +4848,7 @@ yydefault:
yyDollar = yyS[yypt-1 : yypt+1]
//line php7/php7.y:1958
{
identifier := node.NewIdentifier(yyDollar[1].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition(yyDollar[1].token))
@ -4863,7 +4863,7 @@ yydefault:
yyDollar = yyS[yypt-2 : yypt+1]
//line php7/php7.y:1971
{
identifier := node.NewIdentifier(yyDollar[2].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[2].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[2].token))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition(yyDollar[2].token))
@ -5288,7 +5288,7 @@ yydefault:
yyDollar = yyS[yypt-1 : yypt+1]
//line php7/php7.y:2249
{
name := node.NewIdentifier(yyDollar[1].token.Value)
name := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(name, positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = expr.NewVariable(name)
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenPosition(yyDollar[1].token))
@ -5540,7 +5540,7 @@ yydefault:
yyDollar = yyS[yypt-1 : yypt+1]
//line php7/php7.y:2435
{
name := node.NewIdentifier(yyDollar[1].token.Value)
name := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(name, positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = expr.NewVariable(name)
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenPosition(yyDollar[1].token))
@ -5552,7 +5552,7 @@ yydefault:
yyDollar = yyS[yypt-4 : yypt+1]
//line php7/php7.y:2445
{
identifier := node.NewIdentifier(yyDollar[1].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition(yyDollar[1].token))
@ -5567,7 +5567,7 @@ yydefault:
yyDollar = yyS[yypt-3 : yypt+1]
//line php7/php7.y:2458
{
identifier := node.NewIdentifier(yyDollar[1].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[1].token))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition(yyDollar[1].token))
@ -5668,7 +5668,7 @@ yydefault:
yyDollar = yyS[yypt-1 : yypt+1]
//line php7/php7.y:2543
{
identifier := node.NewIdentifier(yyDollar[1].token.Value)
identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition(yyDollar[1].token))
yyVAL.node = expr.NewVariable(identifier)
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenPosition(yyDollar[1].token))

View File

@ -689,7 +689,7 @@ catch_list:
/* empty */ { $$ = []node.Node{} }
| catch_list T_CATCH '(' catch_name_list T_VARIABLE ')' '{' inner_statement_list '}'
{
identifier := node.NewIdentifier($5.Value)
identifier := node.NewIdentifier(strings.TrimLeft($5.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($5))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition($5))
@ -1010,7 +1010,7 @@ non_empty_parameter_list:
parameter:
optional_type is_reference is_variadic T_VARIABLE
{
identifier := node.NewIdentifier($4.Value)
identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($4))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition($4))
@ -1038,7 +1038,7 @@ parameter:
}
| optional_type is_reference is_variadic T_VARIABLE '=' expr
{
identifier := node.NewIdentifier($4.Value)
identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($4))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition($4))
@ -1144,7 +1144,7 @@ static_var_list:
static_var:
T_VARIABLE
{
identifier := node.NewIdentifier($1.Value)
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($1))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition($1))
@ -1157,7 +1157,7 @@ static_var:
}
| T_VARIABLE '=' expr
{
identifier := node.NewIdentifier($1.Value)
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($1))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition($1))
@ -1375,7 +1375,7 @@ property_list:
property:
T_VARIABLE backup_doc_comment
{
identifier := node.NewIdentifier($1.Value)
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($1))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition($1))
@ -1388,7 +1388,7 @@ property:
}
| T_VARIABLE '=' expr backup_doc_comment
{
identifier := node.NewIdentifier($1.Value)
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($1))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition($1))
@ -1956,7 +1956,7 @@ lexical_var_list:
lexical_var:
T_VARIABLE
{
identifier := node.NewIdentifier($1.Value)
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($1))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition($1))
@ -1969,7 +1969,7 @@ lexical_var:
}
| '&' T_VARIABLE
{
identifier := node.NewIdentifier($2.Value)
identifier := node.NewIdentifier(strings.TrimLeft($2.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($2))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition($2))
@ -2248,7 +2248,7 @@ variable:
simple_variable:
T_VARIABLE
{
name := node.NewIdentifier($1.Value)
name := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(name, positionBuilder.NewTokenPosition($1))
$$ = expr.NewVariable(name)
positions.AddPosition($$, positionBuilder.NewTokenPosition($1))
@ -2434,7 +2434,7 @@ encaps_list:
encaps_var:
T_VARIABLE
{
name := node.NewIdentifier($1.Value)
name := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(name, positionBuilder.NewTokenPosition($1))
$$ = expr.NewVariable(name)
positions.AddPosition($$, positionBuilder.NewTokenPosition($1))
@ -2444,7 +2444,7 @@ encaps_var:
}
| T_VARIABLE '[' encaps_var_offset ']'
{
identifier := node.NewIdentifier($1.Value)
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($1))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition($1))
@ -2457,7 +2457,7 @@ encaps_var:
}
| T_VARIABLE T_OBJECT_OPERATOR T_STRING
{
identifier := node.NewIdentifier($1.Value)
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($1))
variable := expr.NewVariable(identifier)
positions.AddPosition(variable, positionBuilder.NewTokenPosition($1))
@ -2542,7 +2542,7 @@ encaps_var_offset:
}
| T_VARIABLE
{
identifier := node.NewIdentifier($1.Value)
identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$"))
positions.AddPosition(identifier, positionBuilder.NewTokenPosition($1))
$$ = expr.NewVariable(identifier)
positions.AddPosition($$, positionBuilder.NewTokenPosition($1))

File diff suppressed because it is too large Load Diff

View File

@ -90,7 +90,7 @@ func ExampleDumper() {
//| "VarName":
//| [*node.Identifier]
//| "Position": Pos{Line: 5-5 Pos: 79-82};
//| "Value": $var;
//| "Value": var;
//| "DefaultValue":
//| [*expr.ConstFetch]
//| "Position": Pos{Line: 5-5 Pos: 86-89};
@ -115,7 +115,7 @@ func ExampleDumper() {
//| "VarName":
//| [*node.Identifier]
//| "Position": Pos{Line: 8-8 Pos: 124-127};
//| "Value": $var;
//| "Value": var;
//| "Comments":
//| "// some comment\n"
}

View File

@ -164,7 +164,7 @@ func TestResolveInstanceOf(t *testing.T) {
},
},
&expr.InstanceOf{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$foo"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
Class: nameBC,
},
},
@ -208,7 +208,7 @@ func TestResolveInstanceCatch(t *testing.T) {
nameBC,
nameF,
},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$foo"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
Stmts: []node.Node{},
},
},
@ -500,7 +500,7 @@ func TestResolveFunctionName(t *testing.T) {
ByRef: false,
Variadic: false,
VariableType: nameAB,
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$foo"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
},
},
ReturnType: &node.Nullable{Expr: nameBC},
@ -538,7 +538,7 @@ func TestResolveMethodName(t *testing.T) {
ByRef: false,
Variadic: false,
VariableType: nameAB,
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$foo"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
},
},
ReturnType: &node.Nullable{Expr: nameBC},
@ -569,7 +569,7 @@ func TestResolveClosureName(t *testing.T) {
ByRef: false,
Variadic: false,
VariableType: nameAB,
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$foo"}},
Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
},
},
ReturnType: &node.Nullable{Expr: nameBC},
@ -708,7 +708,7 @@ func TestResolveStaticCallDinamicClassName(t *testing.T) {
ast := &stmt.StmtList{
Stmts: []node.Node{
&expr.StaticCall{
Class: &expr.Variable{VarName: &node.Identifier{Value: "$foo"}},
Class: &expr.Variable{VarName: &node.Identifier{Value: "foo"}},
Call: &node.Identifier{Value: "foo"},
Arguments: []node.Node{},
},