NIfStatement
Represents an if statement in the AST, with optional else branch.
Instance Members
condition: NExprThe condition to evaluate.
conditionStyle: ConditionStyleThe style of the condition (plain or parentheses).
thenBranch: NBlockArray of nodes to execute if condition is true.
Optional array of nodes to execute if condition is false.
Comments that appear before the else keyword.
Comments that appear after the else keyword.
type(): String| Returns |
|---|
| String |
each(handleNode: Function): Void| Name | Type |
|---|---|
handleNode |
Function |
toJson(): DynamicConverts the if statement to a JSON representation.
| Returns | Description |
|---|---|
| Dynamic | Dynamic object containing if statement data |
new(id: NodeId, pos: Position, condition: NExpr, conditionStyle: ConditionStyle, thenBranch: NBlock, elseBranch: Null<NBlock>, ?leadingComments: Array<Comment>, ?trailingComments: Array<Comment>, ?elseLeadingComments: Array<Comment>, ?elseTrailingComments: Array<Comment>): VoidCreates a new if statement node.
| Name | Type | Default | Description |
|---|---|---|---|
id |
NodeId | ||
pos |
Position | Position in source where this if statement appears | |
condition |
NExpr | Expression to evaluate | |
conditionStyle |
ConditionStyle | The style of the condition (plain or parentheses) | |
thenBranch |
NBlock | Nodes to execute if condition is true | |
elseBranch |
Null<NBlock> | Optional nodes to execute if condition is false | |
leadingComments |
Array<Comment> | (optional) | Optional comments before the if |
trailingComments |
Array<Comment> | (optional) | Optional comments after the if |
elseLeadingComments |
Array<Comment> | (optional) | Optional comments before the else |
elseTrailingComments |
Array<Comment> | (optional) | Optional comments after the else |
Metadata
| Name | Parameters |
|---|---|
:hxGen |
- |