1 package gnu.expr; 2 import gnu.bytecode.*; 3 4 /** A piece of code that needs to be added to {@code <clinit>}, {@code <init>}, or whatever. */ 5 6 public abstract class Initializer 7 { 8 Initializer next; 9 10 /** If non-null: The Field that is being initialized. */ 11 public Field field; 12 emit(Compilation comp)13 public abstract void emit(Compilation comp); 14 reverse(Initializer list)15 public static Initializer reverse(Initializer list) 16 { 17 // Algorithm takes from gcc's tree.c. 18 Initializer prev = null; 19 while (list != null) 20 { 21 Initializer next = list.next; 22 list.next = prev; 23 prev = list; 24 list = next; 25 } 26 return prev; 27 } 28 reportError(String message, Compilation comp)29 public void reportError (String message, Compilation comp) 30 { 31 comp.error('e', message+"field "+field); 32 } 33 } 34