IfNode

class IfNode(guard: AtomicExpressionNode, thenBranch: BlockNode, elseBranch: BlockNode, sourceLocation: SourceLocation) : ControlNode

Executing statements conditionally.

Parameters

thenBranch

Statement to execute if the guard is true.

elseBranch

Statement to execute if the guard is false.

Constructors

IfNode
Link copied to clipboard
fun IfNode(guard: AtomicExpressionNode, thenBranch: BlockNode, elseBranch: BlockNode, sourceLocation: SourceLocation)

Functions

copy
Link copied to clipboard
open override fun copy(children: List<Node>): IfNode

Returns a shallow copy of this node where the child nodes are replaced by children.

toDocument
Link copied to clipboard
override fun toDocument(): Document
toDocumentWithMetadata
Link copied to clipboard
fun toDocumentWithMetadata(metadata: Metadata): Document

Returns a pretty representation of this Node where each descendant is decorated using metadata.

toSurfaceNode
Link copied to clipboard
open override fun toSurfaceNode(metadata: Metadata): IfNode

Returns a representation of this node in the surface syntax.

Properties

children
Link copied to clipboard
open override val children: Iterable<Node>
elseBranch
Link copied to clipboard
val elseBranch: BlockNode
guard
Link copied to clipboard
val guard: AtomicExpressionNode
sourceLocation
Link copied to clipboard
open override val sourceLocation: SourceLocation
thenBranch
Link copied to clipboard
val thenBranch: BlockNode