IfNode class

Represents an if-then-else conditional statement in Balbismo.

An if node implements conditional execution based on a boolean condition. If the condition evaluates to non-zero (true), the then-block is executed. If an else-block is provided and the condition is zero (false), the else-block is executed instead.

Example Balbismo code:

int x = 10;
if (x > 5) {        // This is an IfNode
  printf("Big\n");
} else {
  printf("Small\n");
}

This generates LLVM IR with conditional branches:

%conditionCast.0 = icmp ne i64 %x, 0
br i1 %conditionCast.0, label %then.0, label %else.0
then.0:
  ; then block code
  br label %end.0
else.0:
  ; else block code
  br label %end.0
end.0:
Inheritance

Constructors

IfNode.new(Node<dynamic, LangVal<LangType>> condition, BlockNode thenBlock, [Node? elseBlock])
Constructs an if statement with condition, then-block, and optional else-block.

Properties

children List<Node>
Child nodes that form the structure of this node.
finalinherited
condition Node<dynamic, LangVal<LangType>>
no setter
elseBlock Node?
no setter
hashCode int
The hash code for this object.
no setterinherited
id int
Unique identifier for this node, used for LLVM register naming.
getter/setter pairinherited
nodeValue → void
The primary value associated with this node (varies by node type).
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
thenBlock BlockNode
no setter

Methods

evaluate(SymbolTable table) → void
Evaluates this AST node and generates corresponding LLVM IR code.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited