01: // Copyright (c) 1999 Per M.A. Bothner.
02: // This is free software; for terms and warranty disclaimer see ./COPYING.
03:
04: package gnu.expr;
05:
06: import gnu.bytecode.Type;
07:
08: /** This represents where a compiler can put the result of an expression. */
09:
10: public abstract class Target {
11: public abstract Type getType();
12:
13: public abstract void compileFromStack(Compilation comp,
14: 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(
21: Type.pointer_type);
22:
23: /** Return a Target to push a value of specified type on JCM stack. */
24: public static Target pushValue(Type type) {
25: return type.isVoid() ? Target.Ignore : StackTarget
26: .getInstance(type);
27: }
28: }
|