class
compiler::InitClosures
sys::Obj compiler::CompilerSupport compiler::CompilerStep compiler::InitClosures
During the Parse step we created a list of all the closures. In InitClosures we map each ClosureExpr into a TypeDef as an anonymous class, then we map ClosureExpr.substitute to call the constructor anonymous class.
Slots
- closureSource
-
ClosureExpr? closure
- clsSource
-
TypeDef? cls
- ctorSource
-
MethodDef? ctor
- doCallSource
-
MethodDef? doCall
- enclosingTypeSource
-
TypeDef? enclosingType
-
private Void genCall()
-
private Void genClass()
-
private Void genCtor()
-
private Void genDoCall()
- genMethodCallSource
-
static MethodDef genMethodCall(Compiler compiler, Loc loc, TypeDef parent, FuncType signature, CallExpr c, Bool firstAsTarget)
This method overrides either call(List) or callx(A...) to push the args onto the stack, then redirect to the specified CallExpr c. We share this code for both closures and curries.
- locSource
-
Loc? loc
- makeSource
-
new make(Compiler compiler)
-
private Void process(ClosureExpr c)
- runSource
-
override Void run()
Overrides compiler::CompilerStep.run
Doc inherited from compiler::CompilerStep.run
Run the step
-
private Void setup(ClosureExpr c)
- signatureSource
-
FuncType? signature
-
private Void substitute()
Generate in-place subtitution of closure:
|->| { ... } => Closure$Cls.make()