Class DynamicClassDfnGenerator
- All Implemented Interfaces:
BiFunction<AggregateWithTraitsSymbol, EK9Parser.DynamicClassDeclarationContext, IRConstruct>
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);
its capture constructor stores each captured value into its field while that constructor's body is built.
THE capture constructor is the one phase 3 recorded (IsCaptureConstructor): its parameter types are exactly
the capture types, in order - the synthetic one, or the developer's own (the tuple's 'interface'). It is read here,
never re-derived: it was the first constructor with the right parameter COUNT, which put the stores into a
same-arity constructor of other types and left the definition-site object's fields absent (lane H, 2026-10-28).
Every other constructor is an ordinary one and stores nothing.
The stores (CaptureStores, each from the parameter at its position) go before the call to _i_init,
so a property initialiser can read what the class captured - stored just before the RETURN, an initialiser reading
a captured value read an unset field (front-end audit FE32) - and outside the partial-construction region, as a
dynamic function's do (DynamicFunctionDfnGenerator): the synthetic constructor through
processSyntheticConstructor, an explicit one just after its construction call.
-
Field Summary
Fields inherited from class AbstractDfnGenerator
generators, notImplicitSuper, operationDfnGenerator, stackContext, synthesisedCallMetaData -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbeforeInstanceInit(OperationInstr operation) The capture stores, in THE capture constructor only.Methods inherited from class AggregateDfnGenerator
createFieldDeclarations, createInitializationOperations, createOperationsForAggregateParts, matchClonedMethodsBySourceToken, processAggregate, processAggregate, withFieldSetStatusCarrierMethods inherited from class AbstractDfnGenerator
createEmptyInitOperation, createInitOperation, createInstanceInitOperation, getParsedModule, newSyntheticInitOperation, processAsMethodOrOperator, processAsMethodOrOperator, processPropertiesForInstanceInit, processSyntheticConstructor, processSyntheticConstructor, 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>
-
beforeInstanceInit
The capture stores, in THE capture constructor only.- Overrides:
beforeInstanceInitin classAggregateDfnGenerator
-