An AST node representing a
switch
statement.
The shape of this node is:
ISwitchNode IExpressionNode <-- getConditionalExpressionNode() IBlockNode <-- getStatementContentsNode() IConditionalNode <-- getCaseNodes()[0] IConditionalNode <-- getCaseNodes()[1] ... ITerminalNode <-- getDefaultNode()
For example,
switch (i) { case 1: return a; case 3: return b; default: return c;
is represented as
ISwitchNode IIdentifierNode "i" IBlockNode IConditionalNode INumericLiteralNode 1 IBlockNode IReturnNode IIdentifierNode "a" IConditionalNode INumericLiteralNode 2 IBlockNode IReturnNode IIdentifierNode "b" ITerminalNode IBlockNode IReturnNode IIdentifierNode "c"
An implicit
IBlockNode
is created for each
case
and
default
clause that doesn't have curly braces.