mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-26 20:14:46 +01:00
Fix parsing of $foo =& new Bar;
By-reference assignments of new expressions are now parsed as AssignRef (instead of just Assign). Closes issue #31.
This commit is contained in:
parent
a81cccff7f
commit
5a947e9843
@ -1,7 +1,7 @@
|
||||
Version 0.9.3-dev
|
||||
-----------------
|
||||
|
||||
Nothing yet.
|
||||
* Fix parsing of `$foo =& new Bar`. It is now properly parsed as `AssignRef` (instead of `Assign`).
|
||||
|
||||
Version 0.9.2 (07.07.2012)
|
||||
--------------------------
|
||||
|
@ -498,7 +498,7 @@ expr:
|
||||
| T_LIST '(' assignment_list ')' '=' expr { $$ = Expr_AssignList[$3, $6]; }
|
||||
| variable '=' expr { $$ = Expr_Assign[$1, $3]; }
|
||||
| variable '=' '&' variable { $$ = Expr_AssignRef[$1, $4]; }
|
||||
| variable '=' '&' new_expr { $$ = Expr_Assign[$1, $4]; } /* reference dropped intentially */
|
||||
| variable '=' '&' new_expr { $$ = Expr_AssignRef[$1, $4]; }
|
||||
| new_expr { $$ = $1; }
|
||||
| T_CLONE expr { $$ = Expr_Clone[$2]; }
|
||||
| variable T_PLUS_EQUAL expr { $$ = Expr_AssignPlus [$1, $3]; }
|
||||
|
@ -1765,7 +1765,7 @@ class PHPParser_Parser
|
||||
}
|
||||
|
||||
protected function yyn179($attributes) {
|
||||
$this->yyval = new PHPParser_Node_Expr_Assign($this->yyastk[$this->stackPos-(4-1)], $this->yyastk[$this->stackPos-(4-4)], $attributes);
|
||||
$this->yyval = new PHPParser_Node_Expr_AssignRef($this->yyastk[$this->stackPos-(4-1)], $this->yyastk[$this->stackPos-(4-4)], $attributes);
|
||||
}
|
||||
|
||||
protected function yyn180($attributes) {
|
||||
|
@ -137,7 +137,7 @@ array(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
13: Expr_Assign(
|
||||
13: Expr_AssignRef(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user