Fix attribute assignment for Error nodes

This commit is contained in:
Nikita Popov 2016-11-23 22:49:55 +01:00
parent 098294beec
commit 27281e9130
3 changed files with 15 additions and 13 deletions

View File

@ -312,7 +312,9 @@ abstract class ParserAbstract implements Parser
}
//$this->traceShift($this->errorSymbol);
$stateStack[++$this->stackPos] = $state = $action;
++$this->stackPos;
$stateStack[$this->stackPos] = $state = $action;
$this->endAttributes = $this->endAttributeStack[$this->stackPos];
break;
case 3:

View File

@ -2,8 +2,6 @@
namespace PhpParser;
use SebastianBergmann\Diff\Parser;
class NodeDumperTest extends \PHPUnit_Framework_TestCase
{
private function canonicalize($string) {

View File

@ -245,13 +245,14 @@ Syntax error, unexpected EOF from 8:12 to 8:12
$foo->
;
-----
!!positions
Syntax error, unexpected ';', expecting T_STRING or T_VARIABLE or '{' or '$' from 3:1 to 3:1
array(
0: Expr_PropertyFetch(
var: Expr_Variable(
0: Expr_PropertyFetch[2:1 - 3:1](
var: Expr_Variable[2:1 - 2:4](
name: foo
)
name: Expr_Error(
name: Expr_Error[3:1 - 3:1](
)
)
)
@ -261,20 +262,21 @@ function foo() {
$bar->
}
-----
!!positions
Syntax error, unexpected '}', expecting T_STRING or T_VARIABLE or '{' or '$' from 4:1 to 4:1
array(
0: Stmt_Function(
0: Stmt_Function[2:1 - 4:1](
byRef: false
name: foo
params: array(
)
returnType: null
stmts: array(
0: Expr_PropertyFetch(
var: Expr_Variable(
0: Expr_PropertyFetch[3:5 - 4:1](
var: Expr_Variable[3:5 - 3:8](
name: bar
)
name: Expr_Error(
name: Expr_Error[4:1 - 4:1](
)
)
)
@ -300,11 +302,11 @@ array(
<?php
new
-----
!!php7
!!php7,positions
Syntax error, unexpected EOF from 2:4 to 2:4
array(
0: Expr_New(
class: Expr_Error(
0: Expr_New[2:1 - 2:4](
class: Expr_Error[2:4 - 2:4](
)
args: array(
)