01: package gnu.expr;
02:
03: import gnu.bytecode.*;
04:
05: public class ObjectExp extends ClassExp {
06: public ObjectExp() {
07: super (true);
08: }
09:
10: protected Expression walk(ExpWalker walker) {
11: return walker.walkObjectExp(this );
12: }
13:
14: public void compile(Compilation comp, Target target) {
15: compile(comp);
16: CodeAttr code = comp.getCode();
17: code.emitNew(type);
18: code.emitDup(1);
19: Method init = Compilation.getConstructor(type, this );
20: if (closureEnvField != null) {
21: LambdaExp caller = outerLambda();
22: Variable closureEnv = Compilation.defaultCallConvention < Compilation.CALL_WITH_CONSUMER ? getOwningLambda().heapFrame
23: : caller.heapFrame != null ? caller.heapFrame
24: : caller.closureEnv;
25: if (closureEnv == null)
26: code.emitPushThis();
27: else
28: code.emitLoad(closureEnv);
29: }
30: code.emitInvokeSpecial(init);
31:
32: target.compileFromStack(comp, getCompiledClassType(comp));
33: }
34:
35: }
|