KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > expr > Target


1 // Copyright (c) 1999 Per M.A. Bothner.
2
// This is free software; for terms and warranty disclaimer see ./COPYING.
3

4 package gnu.expr;
5
6 import gnu.bytecode.Type;
7
8 /** This represents where a compiler can put the result of an expression. */
9
10 public abstract class Target
11 {
12   public abstract Type getType();
13
14   public abstract void compileFromStack(Compilation comp, Type stackType);
15
16   /** A Target which means that the result is ignored. */
17   public static final Target Ignore = new IgnoreTarget();
18
19   /** A Target which means to push an Object on the JVM stack. */
20   public static final Target pushObject = new StackTarget(Type.pointer_type);
21
22   /** Return a Target to push a value of specified type on JCM stack. */
23   public static Target pushValue(Type type)
24   {
25     return type.isVoid() ? Target.Ignore : StackTarget.getInstance(type);
26   }
27 }
28
Popular Tags