split Switch and AltSwitch nodes

This commit is contained in:
z7zmey
2018-02-18 20:39:41 +02:00
parent d0296f78e3
commit e75a625528
9 changed files with 897 additions and 824 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -552,7 +552,11 @@ statement:
}
| T_SWITCH '(' expr ')' switch_case_list
{
$$ = stmt.NewSwitch($3, $5.nodes)
if ($5.endToken.Value == ";") {
$$ = stmt.NewAltSwitch($3, $5.nodes)
} else {
$$ = stmt.NewSwitch($3, $5.nodes)
}
positions.AddPosition($$, positionBuilder.NewTokensPosition($1, $5.endToken))
comments.AddComments($$, $1.Comments())
}

View File

@@ -1423,7 +1423,7 @@ CAD;
},
},
},
&stmt.Switch{
&stmt.AltSwitch{
Cond: &scalar.Lnumber{Value: "1"},
Cases: []node.Node{
&stmt.Case{
@@ -1439,7 +1439,7 @@ CAD;
},
},
},
&stmt.Switch{
&stmt.AltSwitch{
Cond: &scalar.Lnumber{Value: "1"},
Cases: []node.Node{
&stmt.Case{