Class DynamicClassDfnGenerator
java.lang.Object
org.ek9lang.compiler.phase7.AbstractDfnGenerator
org.ek9lang.compiler.phase7.AggregateDfnGenerator
org.ek9lang.compiler.phase7.DynamicClassDfnGenerator
- All Implemented Interfaces:
BiFunction<AggregateWithTraitsSymbol, EK9Parser.DynamicClassDeclarationContext, IRConstruct>
public final class DynamicClassDfnGenerator
extends AggregateDfnGenerator
implements BiFunction<AggregateWithTraitsSymbol, EK9Parser.DynamicClassDeclarationContext, IRConstruct>
Creates the appropriate IR Construct for a dynamic class declaration (anonymous inline class).
Dynamic classes are regular classes with captured variables from the enclosing scope.
This generator extends AggregateDfnGenerator to reuse the full aggregate processing
pipeline (fields, c_init, i_init, methods/operators, dispatch tables, coverage instrumentation)
and then augments the capture constructor with STORE_FIELD instructions for each captured variable.
The capture constructor pattern matches DynamicFunctionDfnGenerator: the synthetic
constructor from Phase 3 goes through processSyntheticConstructor() which generates
call super → call i_init → return this. This generator inserts STORE_FIELD + RETAIN
for each captured parameter before the RETURN instruction.
-
Field Summary
Fields inherited from class AbstractDfnGenerator
generators, notImplicitSuper, operationDfnGenerator, stackContext, voidStr -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionMethods inherited from class AggregateDfnGenerator
createFieldDeclarations, createInitializationOperations, createOperationsForAggregateParts, processAggregateMethods inherited from class AbstractDfnGenerator
createDebugInfoCreator, createInitOperation, createInstanceInitOperation, getParsedModule, newPerConstructContext, newSyntheticInitOperation, processAsMethodOrOperator, processPropertiesForInstanceInit, processSyntheticConstructorMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiFunction
andThen
-
Constructor Details
-
DynamicClassDfnGenerator
-
-
Method Details
-
apply
public IRConstruct apply(AggregateWithTraitsSymbol symbol, EK9Parser.DynamicClassDeclarationContext ctx) - Specified by:
applyin interfaceBiFunction<AggregateWithTraitsSymbol, EK9Parser.DynamicClassDeclarationContext, IRConstruct>
-