01: package gnu.expr;
02:
03: import gnu.bytecode.*;
04:
05: /** A piece of code that needs to be added to <clinit>, <init>, or whatever. */
06:
07: public abstract class Initializer {
08: Initializer next;
09:
10: /** If non-null: The Field that is being initialized. */
11: public Field field;
12:
13: public abstract void emit(Compilation comp);
14:
15: public static Initializer reverse(Initializer list) {
16: // Algorithm takes from gcc's tree.c.
17: Initializer prev = null;
18: while (list != null) {
19: Initializer next = list.next;
20: list.next = prev;
21: prev = list;
22: list = next;
23: }
24: return prev;
25: }
26:
27: public void reportError(String message, Compilation comp) {
28: comp.error('e', message + "field " + field);
29: }
30: }
|