Class ObjectAccessInstrGenerator
java.lang.Object
org.ek9lang.compiler.phase7.generator.AbstractGenerator
org.ek9lang.compiler.phase7.generator.ObjectAccessInstrGenerator
Creates IR instructions for object access expressions.
Handles constructor calls and method calls using resolved symbols.
Generates new BasicBlock IR (IRInstructions).
Supports method chaining patterns like Constructor().method() by:
- Processing objectAccessStart (constructor/identifier/primaryReference) first
- Walking the objectAccess chain iteratively
- Applying ARC memory management for each intermediate temp
- Storing the final result to the target variable
Grammar structure:
objectAccessExpression : objectAccessStart objectAccess objectAccessStart : (primaryReference | identifier | call) objectAccess : objectAccessType objectAccess? // RECURSIVE objectAccessType : DOT (identifier | operationCall)
-
Field Summary
Fields inherited from class AbstractGenerator
debugInfoCreator, instructionBuilder, MAX_MESSAGE_LENGTH, stackContext, typeNameOrException -
Constructor Summary
ConstructorsConstructorDescriptionObjectAccessInstrGenerator(IRGenerationContext stackContext, GeneratorSet generators) -
Method Summary
Modifier and TypeMethodDescriptionapply(EK9Parser.ObjectAccessExpressionContext ctx, VariableDetails variableDetails) Generate IR instructions for object access expression using resolved symbols.
-
Constructor Details
-
ObjectAccessInstrGenerator
ObjectAccessInstrGenerator(IRGenerationContext stackContext, GeneratorSet generators)
-
-
Method Details
-
apply
public List<IRInstr> apply(EK9Parser.ObjectAccessExpressionContext ctx, VariableDetails variableDetails) Generate IR instructions for object access expression using resolved symbols. Handles both simple cases (likestdout.println()) and chained cases (likeDateTime().now()).When variableDetails is null, the expression is evaluated for its side effects only (e.g., method calls that might throw exceptions in assertion bodies). No result storage is generated in this case.
-