Class AbstractDfnGenerator

java.lang.Object
org.ek9lang.compiler.phase7.AbstractDfnGenerator
Direct Known Subclasses:
AggregateDfnGenerator, FunctionDfnGenerator, ProgramDfnGenerator

abstract class AbstractDfnGenerator extends Object
Acts as a base for the main construct definitions. As there are lots of common processing aspects across constructs and, they are only really very focussed on IR generation (and not reusable elsewhere) hence defined in this base.
  • Field Details

  • Constructor Details

    • AbstractDfnGenerator

      AbstractDfnGenerator(IRGenerationContext stackContext)
      Primary constructor using stack context - the single source of truth.
  • Method Details

    • getParsedModule

      protected ParsedModule getParsedModule()
      Get the parsed module from stack context - the single source of truth.
    • createCallMetaDataExtractor

      protected CallMetaDataExtractor createCallMetaDataExtractor()
      Create CallMetaDataExtractor using stack context - the single source of truth.
    • createDebugInfoCreator

      protected DebugInfoCreator createDebugInfoCreator()
      Create DebugInfoCreator using stack context - the single source of truth.
    • processAsMethodOrOperator

      protected void processAsMethodOrOperator(IRConstruct construct, ISymbol symbol, EK9Parser.OperationDetailsContext ctx)
    • newPerConstructContext

      protected IRContext newPerConstructContext()
      Create a new IRContext for per-construct isolation. This ensures each construct gets fresh block labeling (_entry_1, _temp_1, etc.) while sharing the core parsedModule and compilerFlags.
    • newSyntheticInitOperation

      protected OperationInstr newSyntheticInitOperation(IScope scope, String methodName)
    • createInitOperation

      protected void createInitOperation(IRConstruct construct, IScope aggregateSymbol, ISymbol superType)
      Create c_init operation for class/static initialization. This runs once per class loading.
    • createInstanceInitOperation

      protected void createInstanceInitOperation(IRConstruct construct, IScope symbol, EK9Parser.AggregatePartsContext ctx)
      Create i_init operation for instance initialization. This handles property REFERENCE declarations and immediate initializations.
    • processPropertiesForInstanceInit

      protected List<IRInstr> processPropertiesForInstanceInit(EK9Parser.AggregatePartsContext ctx)
      Process all properties for instance initialization. Generates REFERENCE declarations and immediate initializations.
    • processSyntheticConstructor

      protected void processSyntheticConstructor(IRConstruct construct, MethodSymbol constructorSymbol, IScopedSymbol superType)
      Process a synthetic constructor (default constructor created by earlier phases). Implements proper constructor inheritance chain: 1. Call super constructor (if not implicit base class) 2. Call own class's i_init method 3. Return this