Class Scenario2WrapperIRGenerator

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

public final class Scenario2WrapperIRGenerator extends Object
Generates IR for Scenario 2 delegation wrappers.

When an extern generic type (e.g., List) is parameterized with a user-defined type (e.g., UserRecord), there's no pre-built Java class for this exact parameterization. This generator creates a delegation wrapper class that:

  • Has a delegate field of the base generic type (e.g., List)
  • Provides type-safe methods that delegate to the base type
  • Uses virtual dispatch for delegate calls (enabling polymorphism)

The generated wrapper follows the pattern established by pre-built wrappers like _List_8F118296... for List of String.

See Also:
  • Constructor Details

    • Scenario2WrapperIRGenerator

      public Scenario2WrapperIRGenerator(IRGenerationContext stackContext)
      Create a new Scenario 2 wrapper IR generator.
      Parameters:
      stackContext - The IR generation context
  • Method Details

    • generate

      public IRConstruct generate(PossibleGenericSymbol parameterizedType)
      Generate the complete IR construct for a Scenario 2 delegation wrapper.
      Parameters:
      parameterizedType - The parameterized type to generate wrapper for (e.g., List of UserRecord)
      Returns:
      The IRConstruct representing the wrapper class