Class Scenario3SourceIRGenerator

java.lang.Object
org.ek9lang.compiler.phase7.Scenario3SourceIRGenerator

public final class Scenario3SourceIRGenerator extends Object
Generates IR for Scenario 3 (USER_DEFINED_SOURCE) parameterized types.

When a user-defined generic type (e.g., SimpleContainer of type T) is parameterized with a concrete type (e.g., SimpleContainer of String), this generator creates the full IR from the generic type's EK9 source code, using the parameterized type's method symbols (which have substituted types from Phase 6 TypeSubstitution).

Key insight: When TypeSubstitution clones methods from the generic type to the parameterized type, the sourceToken is preserved (same object reference). This allows us to match parameterized methods back to their AST contexts in the generic type's ParsedModule by comparing sourceToken identity.

See Also:
  • Constructor Details

    • Scenario3SourceIRGenerator

      public Scenario3SourceIRGenerator(IRGenerationContext stackContext)
      Create a new Scenario 3 source IR generator.
      Parameters:
      stackContext - The IR generation context
  • Method Details

    • generate

      public IRConstruct generate(PossibleGenericSymbol parameterizedType)
      Generate the complete IR construct for a Scenario 3 user-defined parameterized type.
      Parameters:
      parameterizedType - The parameterized type to generate IR for (e.g., SimpleContainer of String)
      Returns:
      The IRConstruct representing the parameterized class