Class Nodes.UnlessNode
java.lang.Object
org.prism.Nodes.Node
org.prism.Nodes.UnlessNode
- Enclosing class:
Nodes
Represents the use of the `unless` keyword, either in the block form or the modifier form.
bar unless foo
^^^^^^^^^^^^^^
unless foo then bar end
^^^^^^^^^^^^^^^^^^^^^^^
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal Nodes.ElseNodeThe else clause of the unless expression, if present.final Nodes.NodeThe condition to be evaluated for the unless expression.final Nodes.StatementsNodeThe body of statements that will executed if the unless condition is falsey.Fields inherited from class org.prism.Nodes.Node
EMPTY_ARRAY, length, startOffset -
Constructor Summary
ConstructorsConstructorDescriptionUnlessNode(int startOffset, int length, Nodes.Node predicate, Nodes.StatementsNode statements, Nodes.ElseNode else_clause) -
Method Summary
Modifier and TypeMethodDescription<T> Taccept(AbstractNodeVisitor<T> visitor) voidsetNewLineFlag(Nodes.Source source, boolean[] newlineMarked) protected String<T> voidvisitChildNodes(AbstractNodeVisitor<T> visitor) Methods inherited from class org.prism.Nodes.Node
endOffset, hasNewLineFlag, setNewLineFlag, toString
-
Field Details
-
predicate
The condition to be evaluated for the unless expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). unless cond then bar end ^^^^ bar unless cond ^^^^ -
statements
The body of statements that will executed if the unless condition is falsey. Will be `nil` if no body is provided. unless cond then bar end ^^^ -
else_clause
The else clause of the unless expression, if present. unless cond then bar else baz end ^^^^^^^^
-
-
Constructor Details
-
UnlessNode
public UnlessNode(int startOffset, int length, Nodes.Node predicate, Nodes.StatementsNode statements, Nodes.ElseNode else_clause)
-
-
Method Details
-
setNewLineFlag
- Overrides:
setNewLineFlagin classNodes.Node
-
visitChildNodes
- Specified by:
visitChildNodesin classNodes.Node
-
childNodes
- Specified by:
childNodesin classNodes.Node
-
accept
- Specified by:
acceptin classNodes.Node
-
toString
- Specified by:
toStringin classNodes.Node
-