gnu.expr
Class Literal

java.lang.Object
  |
  +--gnu.expr.Initializer
        |
        +--gnu.expr.Literal

public class Literal
extends Initializer

A Literal contains compile-time information about a constant.


Field Summary
static int ALLOCATED
          Bit in flags used to indicate the value has been allocated.
static int ALLOCATING
          Flag used to indicate intent to allocate the value.
static int ASSIGNED
           
 int flags
           
static int INITIALIZED
          Bit in flags indicates that the value has been fully initialized.
static Literal nullLiteral
           
 Type type
           
 
Fields inherited from class gnu.expr.Initializer
field
 
Constructor Summary
Literal(java.lang.Object value, Compilation comp)
          Create a new Literal, where comp must be in immediate mode.
Literal(java.lang.Object value, Field field, Compilation comp)
          Create a new Literal, for a value available from a static field.
Literal(java.lang.Object value, java.lang.String name, Compilation comp)
           
Literal(java.lang.Object value, Type type, Compilation comp)
           
 
Method Summary
 void check_cycle()
          Utility function to check for circular literals dependencies.
 void emit(Compilation comp)
           
 java.lang.Object getValue()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

public Type type

flags

public int flags

ALLOCATING

public static final int ALLOCATING
Flag used to indicate intent to allocate the value. The ALLOCATING flag is true if someone has committed to allocate the value, but has not necessarily finished doing so. The flag is used to detect circularities.

ALLOCATED

public static final int ALLOCATED
Bit in flags used to indicate the value has been allocated. I.e. it has been allocated, but it is not necessarily initialized.

INITIALIZED

public static final int INITIALIZED
Bit in flags indicates that the value has been fully initialized.

ASSIGNED

public static final int ASSIGNED

nullLiteral

public static final Literal nullLiteral
Constructor Detail

Literal

public Literal(java.lang.Object value,
               Compilation comp)
Create a new Literal, where comp must be in immediate mode.

Literal

public Literal(java.lang.Object value,
               java.lang.String name,
               Compilation comp)

Literal

public Literal(java.lang.Object value,
               Field field,
               Compilation comp)
Create a new Literal, for a value available from a static field. The field must be static and already exist.

Literal

public Literal(java.lang.Object value,
               Type type,
               Compilation comp)
Method Detail

getValue

public final java.lang.Object getValue()

emit

public void emit(Compilation comp)
Overrides:
emit in class Initializer

check_cycle

public void check_cycle()
Utility function to check for circular literals dependencies. Use this in a Compilable.emit method if circularities are not allowed (perhaps because it it not worth the trouble to handle them).