KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > expr > ObjectExp


1 package gnu.expr;
2 import gnu.bytecode.*;
3
4 public class ObjectExp extends ClassExp
5 {
6   public ObjectExp ()
7   {
8     super(true);
9   }
10
11   protected Expression walk (ExpWalker walker)
12   {
13     return walker.walkObjectExp(this);
14   }
15
16   public void compile (Compilation comp, Target target)
17   {
18     compile (comp);
19     CodeAttr code = comp.getCode();
20     code.emitNew(type);
21     code.emitDup(1);
22     Method init = Compilation.getConstructor(type, this);
23     if (closureEnvField != null)
24       {
25     LambdaExp caller = outerLambda();
26     Variable closureEnv =
27       Compilation.defaultCallConvention < Compilation.CALL_WITH_CONSUMER ? getOwningLambda().heapFrame
28       : caller.heapFrame != null ? caller.heapFrame : caller.closureEnv;
29     if (closureEnv == null)
30       code.emitPushThis();
31     else
32       code.emitLoad(closureEnv);
33       }
34     code.emitInvokeSpecial(init);
35
36     target.compileFromStack(comp, getCompiledClassType(comp));
37   }
38
39 }
40
Popular Tags