split Exit and Die nodes

This commit is contained in:
z7zmey
2018-02-18 19:09:18 +02:00
parent f107e8bb57
commit 1c6633e47d
10 changed files with 437 additions and 399 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1844,7 +1844,11 @@ expr_without_variable:
}
| T_EXIT exit_expr
{
$$ = expr.NewExit($2, strings.EqualFold($1.Value, "die"))
if (strings.EqualFold($1.Value, "die")) {
$$ = expr.NewDie($2)
} else {
$$ = expr.NewExit($2)
}
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
comments.AddComments($$, $1.Comments())
}

View File

@@ -2206,25 +2206,19 @@ CAD;
},
},
&stmt.Expression{
Expr: &expr.Exit{
IsDie: false,
},
Expr: &expr.Exit{},
},
&stmt.Expression{
Expr: &expr.Exit{
IsDie: false,
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
},
},
&stmt.Expression{
Expr: &expr.Exit{
IsDie: true,
},
Expr: &expr.Die{},
},
&stmt.Expression{
Expr: &expr.Exit{
IsDie: true,
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
Expr: &expr.Die{
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
},
},
&stmt.Expression{