Class Scenario2WrapperHelper
java.lang.Object
org.ek9lang.compiler.phase7.Scenario2WrapperHelper
Shared utilities for Scenario 2 wrapper IR generation.
Provides common operations needed by all Scenario 2 specialist generators:
- Temporary variable and scope ID generation
- Type name resolution from Ek9Types
- Operator name mapping (symbol to method name)
- Type erasure for delegation (finding base method parameter/return types)
- Basic block creation
- Delegate field load pattern
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) String(package private) final Ek9Types(package private) PossibleGenericSymbol(package private) String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) booleancontainedTypeHasOperator(ISymbol type, String operatorMethodName) Check if a type has a specific operator method.(package private) BasicBlockInstrcreateBasicBlock(List<IRInstr> instructions) (package private) DebugInfo(package private) int(package private) StringextractPrimitiveBoolean(List<IRInstr> instructions, String booleanVar, DebugInfo debugInfo) Extract primitive boolean from Boolean object via _true() method.(package private) StringgenerateConstructorCallInstructions(List<IRInstr> instructions, String typeName, List<String> paramTypes, List<String> argNames, String scopeId, DebugInfo debugInfo) Generate a constructor call on a type and manage memory.(package private) StringgenerateScopeId(String prefix) (package private) String(package private) StringgenerateUnsetBoolean(List<IRInstr> instructions, String scopeId, DebugInfo debugInfo) Generate an unset Boolean constructor call.(package private) StringgenerateVirtualCall(List<IRInstr> instructions, String targetVar, String targetType, String methodName, List<String> paramTypes, String returnType, List<String> argNames, String scopeId, DebugInfo debugInfo) Generate a virtual method call on a target and manage memory.(package private) StringGet the parameter types from the BASE generic type's method, not the substituted version.(package private) StringgetBaseMethodReturnType(MethodSymbol method) Get the return type from the BASE generic type's method, not the substituted version.(package private) String(package private) String(package private) String(package private) String(package private) booleanisCollectionType(String baseTypeName) Check if the base type is a collection type.(package private) StringloadDelegate(List<IRInstr> instructions, String scopeId, DebugInfo debugInfo) Generate delegate field load with memory management.(package private) voidstoreReturnValue(List<IRInstr> instructions, String valueVar, DebugInfo debugInfo) Store a value into the return variable and retain for ownership transfer.(package private) StringtoMethodName(String operatorOrMethodName) Convert operator symbols to their mapped method names for use in IR.
-
Field Details
-
ek9Types
-
wrapperTypeName
String wrapperTypeName -
delegateTypeName
String delegateTypeName -
parameterizedAggregate
PossibleGenericSymbol parameterizedAggregate
-
-
Constructor Details
-
Scenario2WrapperHelper
Scenario2WrapperHelper(Ek9Types ek9Types)
-
-
Method Details
-
generateTempName
String generateTempName() -
generateScopeId
-
currentScopeCounter
int currentScopeCounter() -
toMethodName
-
createDebugInfo
DebugInfo createDebugInfo() -
createBasicBlock
-
getBooleanTypeName
String getBooleanTypeName() -
getVoidTypeName
String getVoidTypeName() -
getStringTypeName
String getStringTypeName() -
getIntegerTypeName
String getIntegerTypeName() -
getAnyTypeName
String getAnyTypeName() -
loadDelegate
Generate delegate field load with memory management.Common pattern used across all generators:
delegateVar = LOAD_FIELD this.delegate (wrapperType -> delegateType) RETAIN delegateVar SCOPE_REGISTER delegateVar, scopeId
-
generateConstructorCallInstructions
-
generateVirtualCall
-
extractPrimitiveBoolean
-
storeReturnValue
-
generateUnsetBoolean
-
containedTypeHasOperator
-
isCollectionType
Check if the base type is a collection type. -
getBaseMethodParameterTypes
Get the parameter types from the BASE generic type's method, not the substituted version. -
getBaseMethodReturnType
Get the return type from the BASE generic type's method, not the substituted version.
-