KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > expr > Initializer


1 package gnu.expr;
2 import gnu.bytecode.*;
3
4 /** A piece of code that needs to be added to <clinit>, <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
13   public abstract void emit(Compilation comp);
14
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
29   public void reportError (String JavaDoc message, Compilation comp)
30   {
31     comp.error('e', message+"field "+field);
32   }
33 }
34
Popular Tags