NChoiceOption
Represents a single option within a choice statement.
Instance Members
text: NStringLiteralThe text displayed for this option.
insertion: NInsertionAlternatively, instead of text, this could be an insertion
Optional condition that must be true for this option to be available.
conditionStyle: ConditionStyleThe style of the condition (plain or parentheses).
Position of the trailing "if condition" clause (from 'if' keyword through condition end).
Array of nodes to execute when this option is chosen.
style: BlockStyleThe block style of the body
once: BoolWhether this option can only be chosen once (disappears after being selected).
type(): String| Returns |
|---|
| String |
each(handleNode: Function): Void| Name | Type |
|---|---|
handleNode |
Function |
toJson(): DynamicConverts the choice option to a JSON representation.
| Returns | Description |
|---|---|
| Dynamic | Dynamic object containing option data |
new(id: NodeId, pos: Position, text: NStringLiteral, insertion: NInsertion, condition: Null<NExpr>, conditionStyle: ConditionStyle, body: Array<AstNode>, ?leadingComments: Array<Comment>, ?trailingComments: Array<Comment>): VoidCreates a new choice option node.
| Name | Type | Default | Description |
|---|---|---|---|
id |
NodeId | ||
pos |
Position | Position in source where this option appears | |
text |
NStringLiteral | String literal containing the option text | |
insertion |
NInsertion | ||
condition |
Null<NExpr> | Optional condition for option availability | |
conditionStyle |
ConditionStyle | The style of the condition (plain or parentheses) | |
body |
Array<AstNode> | Array of nodes to execute when chosen | |
leadingComments |
Array<Comment> | (optional) | Optional comments before the option |
trailingComments |
Array<Comment> | (optional) | Optional comments after the option |