Class Scenario2AggregateWrapperGenerator
java.lang.Object
org.ek9lang.compiler.phase7.Scenario2AggregateWrapperGenerator
Generates IR for Scenario 2 aggregate wrapper constructors, delegation, and function-accepting methods.
Handles:
- Constructor operations - create delegate instance and store in field
- Wrapping constructor - accepts existing delegate for return-type wrapping
- Standard delegation - load delegate, call method, handle return type wrapping/casting
- Function-accepting methods - inline implementations for whenPresent/whenOk/whenError
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidgenerateConstructorOperation(IRConstruct construct, MethodSymbol method, String baseTypeName) Generate constructor that creates the delegate instance.(package private) voidgenerateDelegationOperation(IRConstruct construct, MethodSymbol method, String baseTypeName) Generate a delegation operation for a single method.(package private) voidgenerateFunctionAcceptingMethod(IRConstruct construct, MethodSymbol method, String baseTypeName) Generate inline implementation for methods that accept function wrapper types.(package private) voidgenerateWrappingConstructor(IRConstruct construct, AggregateSymbol aggregateSymbol, String baseTypeName) Generate wrapping constructor that takes the base type as parameter.(package private) booleanisCallbackInvocationMethod(MethodSymbol method, Scenario2WrapperHelper helper) Detect callback-invocation methods: methods whose contract is "invoke the supplied function on the contained value".
-
Constructor Details
-
Scenario2AggregateWrapperGenerator
Scenario2AggregateWrapperGenerator(Scenario2WrapperHelper helper)
-
-
Method Details
-
isCallbackInvocationMethod
Detect callback-invocation methods: methods whose contract is "invoke the supplied function on the contained value".Structural signature: at least one parameter is a parameterised function type (Acceptor/Consumer/Predicate/...) and the method's return type is void. The void return is the discriminator that separates callback methods (Optional.whenPresent, Result.whenOk, Result.whenError — all void) from configuration methods that take a function as state (PriorityQueue.withComparator returns a new PriorityQueue and must go through standard delegation).
-
generateConstructorOperation
Generate constructor that creates the delegate instance. -
generateWrappingConstructor
void generateWrappingConstructor(IRConstruct construct, AggregateSymbol aggregateSymbol, String baseTypeName) Generate wrapping constructor that takes the base type as parameter. -
generateDelegationOperation
Generate a delegation operation for a single method. -
generateFunctionAcceptingMethod
void generateFunctionAcceptingMethod(IRConstruct construct, MethodSymbol method, String baseTypeName) Generate inline implementation for methods that accept function wrapper types.
-