Class CaptureConstructorCreator
java.lang.Object
org.ek9lang.compiler.phase3.CaptureConstructorCreator
- All Implemented Interfaces:
Consumer<EK9Parser.DynamicClassDeclarationContext>
final class CaptureConstructorCreator
extends Object
implements Consumer<EK9Parser.DynamicClassDeclarationContext>
Creates the sole synthetic constructor for dynamic classes.
Phase 2 deliberately does NOT create constructors for dynamic classes.
This creator runs in Phase 3 after captures are resolved by DynamicCaptureOrError,
and creates either:
- A no-arg constructor when captures are empty
- A capture-based constructor when captures are present
Only one constructor is created — never both. This ensures that dynamic classes with
captured fields cannot be instantiated via a no-arg constructor that would leave
those fields uninitialized. Users who want unset fields can pass unset values
explicitly (e.g. String(), Integer()).
-
Constructor Summary
ConstructorsConstructorDescriptionCaptureConstructorCreator(SymbolsAndScopes symbolsAndScopes, AggregateManipulator aggregateManipulator) -
Method Summary
-
Constructor Details
-
CaptureConstructorCreator
CaptureConstructorCreator(SymbolsAndScopes symbolsAndScopes, AggregateManipulator aggregateManipulator)
-
-
Method Details
-
accept
- Specified by:
acceptin interfaceConsumer<EK9Parser.DynamicClassDeclarationContext>
-