#50: nodes stmt.Exit and stmt.Die was merged
This commit is contained in:
283
php7/php7.go
283
php7/php7.go
File diff suppressed because it is too large
Load Diff
23
php7/php7.y
23
php7/php7.y
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user