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)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final recordResult holder for each step in the chain processing. -
Field Summary
Fields inherited from class AbstractGenerator
constantCopyOnAccessLoader, debugInfoCreator, instructionBuilder, MAX_MESSAGE_LENGTH, stackContext, synthesisedCallMetaData, 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.(package private) ObjectAccessInstrGenerator.ChainStepResultreceiverOfFinalStep(EK9Parser.ObjectAccessExpressionContext ctx, List<IRInstr> instructions) THE receiver of a chain's FINAL step -getHolder()ingetHolder().name,keeper.holder()inkeeper.holder().name- evaluated into a temp by exactly the lowering the read side uses for the same chain (start, calls and property loads, with their ARC), so an assignment target that reaches its field through a call cannot lower the call differently from a read of it.
-
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.
-
receiverOfFinalStep
ObjectAccessInstrGenerator.ChainStepResult receiverOfFinalStep(EK9Parser.ObjectAccessExpressionContext ctx, List<IRInstr> instructions) THE receiver of a chain's FINAL step -getHolder()ingetHolder().name,keeper.holder()inkeeper.holder().name- evaluated into a temp by exactly the lowering the read side uses for the same chain (start, calls and property loads, with their ARC), so an assignment target that reaches its field through a call cannot lower the call differently from a read of it. Used byAssignmentStmtGeneratorfor a field reached through a call (QA1363).
-