TypeCast class
Represents a type cast operation in Balbismo.
A type cast node converts a value from one primitive type to another. Currently supports casting between int and float types in both directions. If the source and target types are the same, the cast is a no-op.
Example Balbismo code:
int x = 42;
float y = (float)x; // This is a TypeCast from int to float
int z = (int)y; // This is a TypeCast from float to int
This generates LLVM IR conversion instructions:
%conv.0 = sitofp i64 %x to double // int to float
%conv.1 = fptosi double %y to i64 // float to int
- Inheritance
-
- Object
- Node<
PrimitiveType, LangVal< LangType> > - TypeCast
Constructors
-
TypeCast.new(PrimitiveType type, Node<
dynamic, LangVal< child)LangType> > - Constructs a type cast operation with target type and source expression.
Properties
-
child
→ Node<
dynamic, LangVal< LangType> > -
no setter
-
children
→ List<
Node> -
Child nodes that form the structure of this node.
finalinherited
- 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 → PrimitiveType
-
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
Methods
-
evaluate(
SymbolTable table) → LangVal< LangType> -
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