Class ObjectAccessInstrGenerator

java.lang.Object
org.ek9lang.compiler.phase7.generator.AbstractGenerator
org.ek9lang.compiler.phase7.generator.ObjectAccessInstrGenerator

public final class ObjectAccessInstrGenerator extends AbstractGenerator
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:

  1. Processing objectAccessStart (constructor/identifier/primaryReference) first
  2. Walking the objectAccess chain iteratively
  3. Applying ARC memory management for each intermediate temp
  4. 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)
  • Constructor Details

  • Method Details

    • apply

      Generate IR instructions for object access expression using resolved symbols. Handles both simple cases (like stdout.println()) and chained cases (like DateTime().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.