Merge branch '2.x'

Conflicts:
	lib/PhpParser/Parser/Php7.php
This commit is contained in:
Nikita Popov 2016-08-30 22:14:09 +02:00
commit d0cfb98133
4 changed files with 548 additions and 529 deletions

View File

@ -524,7 +524,6 @@ expr:
| array_short_syntax '=' expr { $$ = Expr\Assign[$1, $3]; }
| variable '=' expr { $$ = Expr\Assign[$1, $3]; }
| variable '=' '&' variable { $$ = Expr\AssignRef[$1, $4]; }
| variable '=' '&' new_expr { $$ = Expr\AssignRef[$1, $4]; }
| new_expr { $$ = $1; }
| T_CLONE expr { $$ = Expr\Clone_[$2]; }
| variable T_PLUS_EQUAL expr { $$ = Expr\AssignOp\Plus [$1, $3]; }

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,6 @@ $a = $b *= $c **= $d;
// by ref assign
$a =& $b;
$a =& new B;
// list() assign
list($a) = $b;
@ -191,21 +190,7 @@ array(
0: // by ref assign
)
)
15: Expr_AssignRef(
var: Expr_Variable(
name: a
)
expr: Expr_New(
class: Name(
parts: array(
0: B
)
)
args: array(
)
)
)
16: Expr_Assign(
15: Expr_Assign(
var: Expr_List(
items: array(
0: Expr_ArrayItem(
@ -227,7 +212,7 @@ array(
0: // list() assign
)
)
17: Expr_Assign(
16: Expr_Assign(
var: Expr_List(
items: array(
0: Expr_ArrayItem(
@ -251,7 +236,7 @@ array(
name: c
)
)
18: Expr_Assign(
17: Expr_Assign(
var: Expr_List(
items: array(
0: Expr_ArrayItem(
@ -286,7 +271,7 @@ array(
name: e
)
)
19: Expr_PreInc(
18: Expr_PreInc(
var: Expr_Variable(
name: a
)
@ -294,17 +279,17 @@ array(
0: // inc/dec
)
)
20: Expr_PostInc(
19: Expr_PostInc(
var: Expr_Variable(
name: a
)
)
21: Expr_PreDec(
20: Expr_PreDec(
var: Expr_Variable(
name: a
)
)
22: Expr_PostDec(
21: Expr_PostDec(
var: Expr_Variable(
name: a
)

View File

@ -0,0 +1,39 @@
Assigning new by reference (PHP 5 only)
-----
<?php
$a =& new B;
-----
!!php5
array(
0: Expr_AssignRef(
var: Expr_Variable(
name: a
)
expr: Expr_New(
class: Name(
parts: array(
0: B
)
)
args: array(
)
)
)
)
-----
<?php
$a =& new B;
-----
!!php7
Syntax error, unexpected T_NEW from 2:7 to 2:9
array(
0: Expr_New(
class: Name(
parts: array(
0: B
)
)
args: array(
)
)
)