#50: nodes stmt.Exit and stmt.Die was merged

This commit is contained in:
z7zmey
2018-07-10 00:51:02 +03:00
parent a69e899f04
commit 18d6d59292
17 changed files with 605 additions and 572 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -3802,16 +3802,17 @@ expr_without_variable:
}
| T_EXIT exit_expr
{
if (strings.EqualFold($1.Value, "die")) {
$$ = expr.NewDie(nil)
if $2 != nil {
$$.(*expr.Die).Expr = $2.(*expr.Exit).Expr
}
var e *expr.Exit;
if $2 != nil {
e = $2.(*expr.Exit)
} else {
$$ = expr.NewExit(nil)
if $2 != nil {
$$.(*expr.Exit).Expr = $2.(*expr.Exit).Expr
}
e = expr.NewExit(nil)
}
$$ = e
if (strings.EqualFold($1.Value, "die")) {
e.Die = true
}
// save position
@@ -4151,8 +4152,8 @@ exit_expr:
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3))
// save comments
addMeta($2, $1.Meta, meta.OpenParenthesisToken)
addMeta($2, $3.Meta, meta.CloseParenthesisToken)
addMeta($$, $1.Meta, meta.OpenParenthesisToken)
addMeta($$, $3.Meta, meta.CloseParenthesisToken)
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
}

View File

@@ -9650,6 +9650,7 @@ func TestPhp7(t *testing.T) {
EndPos: 4286,
},
Expr: &expr.Exit{
Die: false,
Position: &position.Position{
StartLine: 200,
EndLine: 200,
@@ -9666,6 +9667,7 @@ func TestPhp7(t *testing.T) {
EndPos: 4298,
},
Expr: &expr.Exit{
Die: false,
Position: &position.Position{
StartLine: 201,
EndLine: 201,
@@ -9698,7 +9700,8 @@ func TestPhp7(t *testing.T) {
StartPos: 4302,
EndPos: 4305,
},
Expr: &expr.Die{
Expr: &expr.Exit{
Die: true,
Position: &position.Position{
StartLine: 202,
EndLine: 202,
@@ -9714,7 +9717,8 @@ func TestPhp7(t *testing.T) {
StartPos: 4309,
EndPos: 4316,
},
Expr: &expr.Die{
Expr: &expr.Exit{
Die: true,
Position: &position.Position{
StartLine: 203,
EndLine: 203,