Class DynamicConstructEmitter
java.lang.Object
org.ek9lang.compiler.phase7.generator.AbstractGenerator
org.ek9lang.compiler.phase7.generator.DynamicConstructEmitter
THE emission of a dynamic class or dynamic function where it is written (INFRA-2): generate its construct in a
fresh
IRContext (counter isolation), add the construct to the IR module, evaluate the captured
expressions, then construct it with those captured values.
The two forms differ in three things only, so those are the parameters: how the construct is generated, the
debug info of the construction, and the metadata of the constructor (which SynthesisedCallMetaData
factory describes it).
-
Field Summary
Fields inherited from class AbstractGenerator
constantCopyOnAccessLoader, instructionBuilder, MAX_MESSAGE_LENGTH, stackContext, symbolTypeOrException, synthesisedCallMetaData, typeNameOrException, variableNameForIR -
Constructor Summary
ConstructorsConstructorDescriptionDynamicConstructEmitter(IRGenerationContext stackContext, GeneratorSet generators) -
Method Summary
Modifier and TypeMethodDescription<T extends ICanCaptureVariables & ISymbol>
List<IRInstr> emit(T dynamicSymbol, Function<IRGenerationContext, IRConstruct> generate, EK9Parser.DynamicVariableCaptureContext captureCtx, DebugInfo debugInfo, String resultVariable, Function<List<ISymbol>, CallMetaDataDetails> metaData) Emit the dynamic construct and the instructions that construct it.
-
Constructor Details
-
DynamicConstructEmitter
DynamicConstructEmitter(IRGenerationContext stackContext, GeneratorSet generators)
-
-
Method Details
-
emit
public <T extends ICanCaptureVariables & ISymbol> List<IRInstr> emit(T dynamicSymbol, Function<IRGenerationContext, IRConstruct> generate, EK9Parser.DynamicVariableCaptureContext captureCtx, DebugInfo debugInfo, String resultVariable, Function<List<ISymbol>, CallMetaDataDetails> metaData) Emit the dynamic construct and the instructions that construct it.- Parameters:
dynamicSymbol- The dynamic function or class - this parameterisation's own copy inside a generic body.generate- Generates the construct, given the nested context to generate it in.captureCtx- The construct's capture list (may be null for none).debugInfo- Debug info of the construction.resultVariable- The variable that receives the constructed object.metaData- The constructor's metadata, given the constructor's own parameter types.- Returns:
- the capture evaluation and the constructor call
-