An AST node representing an
if
statement.
The shape of this node is
IIfNode IConditionalNode <-- ??? IConditionalNode <-- getElseIfNodes()[0] IConditionalNode <-- getElseIfNodes()[1] ... ITerminalNode <-- getElseNode()
Example 1:
if (a > b) return 1;
is represented as
IIfNode IConditionalNode IBinaryOperatorNode ">" IIdentifierNode "a" IIdentifierNode "b" IBlockNode IReturnNode INumericLiteralNode 1
Example 2:
if (a > b) return 1; else return 2;
is represented as
IIfNode IConditionalNode IBinaryOperatorNode ">" IIdentifierNode "a" IIdentifierNode "b" IBlockNode IReturnNode INumericLiteralNode 1 ITerminalNode "else" IBlockNode IReturnNode INumericLiteralNode 2
Example 3:
if (a > b) return 1; else if (a < b) return -1; else return 0;
is represented as
IIfNode IConditionalNode IBinaryOperatorNode ">" IIdentifierNode "a" IIdentifierNode "b" IBlockNode IReturnNode INumericLiteralNode 1 IConditionalNode IBinaryOperatorNode "<" IIdentifierNode "a" IIdentifierNode "b" IBlockNode IReturnNode INumericLiteralNode -1 ITerminalNode "else" IBlockNode IReturnNode INumericLiteralNode 0