Class AbstractDfnGenerator
java.lang.Object
org.ek9lang.compiler.phase7.AbstractDfnGenerator
- Direct Known Subclasses:
AggregateDfnGenerator, FunctionDfnGenerator, ProgramDfnGenerator
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 Summary
FieldsModifier and TypeFieldDescriptionprotected final GeneratorSetprotected final NotImplicitSuperprotected final OperationDfnGeneratorprotected final IRGenerationContextprotected final String -
Constructor Summary
ConstructorsConstructorDescriptionAbstractDfnGenerator(IRGenerationContext stackContext) Primary constructor using stack context - the single source of truth. -
Method Summary
Modifier and TypeMethodDescriptionprotected CallMetaDataExtractorCreate CallMetaDataExtractor using stack context - the single source of truth.protected DebugInfoCreatorCreate DebugInfoCreator using stack context - the single source of truth.protected voidcreateInitOperation(IRConstruct construct, IScope aggregateSymbol, ISymbol superType) Create c_init operation for class/static initialization.protected voidcreateInstanceInitOperation(IRConstruct construct, IScope symbol, EK9Parser.AggregatePartsContext ctx) Create i_init operation for instance initialization.protected ParsedModuleGet the parsed module from stack context - the single source of truth.protected IRContextCreate a new IRContext for per-construct isolation.protected OperationInstrnewSyntheticInitOperation(IScope scope, String methodName) protected voidprocessAsMethodOrOperator(IRConstruct construct, ISymbol symbol, EK9Parser.OperationDetailsContext ctx) Process all properties for instance initialization.protected voidprocessSyntheticConstructor(IRConstruct construct, MethodSymbol constructorSymbol, IScopedSymbol superType) Process a synthetic constructor (default constructor created by earlier phases).
-
Field Details
-
notImplicitSuper
-
operationDfnGenerator
-
stackContext
-
voidStr
-
generators
-
-
Constructor Details
-
AbstractDfnGenerator
AbstractDfnGenerator(IRGenerationContext stackContext) Primary constructor using stack context - the single source of truth. Creates the complete generator tree once for efficient reuse via static factory.
-
-
Method Details
-
getParsedModule
Get the parsed module from stack context - the single source of truth. -
createCallMetaDataExtractor
Create CallMetaDataExtractor using stack context - the single source of truth. -
createDebugInfoCreator
Create DebugInfoCreator using stack context - the single source of truth. -
processAsMethodOrOperator
protected void processAsMethodOrOperator(IRConstruct construct, ISymbol symbol, EK9Parser.OperationDetailsContext ctx) -
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
-
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
Process all properties for instance initialization. Generates REFERENCE declarations and immediate initializations. REFACTORED: Now reuses generators from shared generator tree instead of creating new instances. -
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
-