gnu.expr
Class Declaration

java.lang.Object
  |
  +--gnu.expr.Declaration
Direct Known Subclasses:
Syntax

public class Declaration
extends java.lang.Object

The static information associated with a local variable binding.


Field Summary
 ScopeExp context
           
 ApplyExp firstCall
          List of ApplyExp where this declaration is the function called.
protected  int flags
           
protected  int id
          Unique id number, to ease print-outs and debugging.
protected  Type type
           
protected  Expression value
          If non-null, the single expression used to set this variable.
 
Constructor Summary
protected Declaration()
           
  Declaration(java.lang.String name)
           
  Declaration(java.lang.String s, Type type)
           
 
Method Summary
 Variable allocateVariable(CodeAttr code)
           
 void assignField(Compilation comp)
           
 void compileStore(Compilation comp)
           
 boolean getCanCall()
           
 boolean getCanRead()
           
 boolean getCanWrite()
           
 int getColumn()
           
 ScopeExp getContext()
          Return the ScopeExp that contains (declares) this Declaration.
 java.lang.String getFile()
           
 int getLine()
          Get the line number of (the start of) this Expression.
 java.lang.String getName()
           
 Type getType()
           
 Expression getValue()
           
 Variable getVariable()
           
 boolean ignorable()
          True if we never need to access this declaration.
 void initBinding(Compilation comp)
          Generate code to initialize the location for this.
 boolean isFluid()
          True if this is a fluid binding (in a FluidLetExp).
 boolean isIndirectBinding()
          True if the value of the variable is the contents of a Binding.
 boolean isLexical()
           
 boolean isPrivate()
           
 boolean isProcedureDecl()
           
 boolean isPublic()
           
 boolean isSimple()
           
 boolean isStatic()
           
 void load(Compilation comp)
           
 void loadOwningObject(Compilation comp)
          If this is a field in some object, load a reference to that object.
 Declaration nextDecl()
           
 void noteValue(Expression value)
           
 void pushIndirectBinding(Compilation comp)
          Create a Binding object, given that isIndirectBinding().
 void setCanCall(boolean called)
           
 void setCanRead(boolean read)
           
 void setCanWrite(boolean written)
           
 void setFile(java.lang.String filename)
           
 void setFlag(boolean setting, int flag)
           
 void setFluid(boolean fluid)
           
 void setIndirectBinding(boolean indirectBinding)
           
 void setLine(int lineno)
           
 void setLine(int lineno, int colno)
           
 void setName(java.lang.String name)
           
 void setPrivate(boolean isPrivate)
           
 void setProcedureDecl(boolean val)
           
 void setSimple(boolean b)
           
 void setType(Type type)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected int id
Unique id number, to ease print-outs and debugging.

context

public ScopeExp context

type

protected Type type

value

protected Expression value
If non-null, the single expression used to set this variable. If the variable can be set more than once, then value is null.

flags

protected int flags

firstCall

public ApplyExp firstCall
List of ApplyExp where this declaration is the function called. The applications are chained using their nextcall fields.
Constructor Detail

Declaration

protected Declaration()

Declaration

public Declaration(java.lang.String name)

Declaration

public Declaration(java.lang.String s,
                   Type type)
Method Detail

getType

public final Type getType()

setType

public final void setType(Type type)

getName

public final java.lang.String getName()

nextDecl

public final Declaration nextDecl()

getVariable

public Variable getVariable()

isSimple

public final boolean isSimple()

setSimple

public final void setSimple(boolean b)

getContext

public final ScopeExp getContext()
Return the ScopeExp that contains (declares) this Declaration.

loadOwningObject

public void loadOwningObject(Compilation comp)
If this is a field in some object, load a reference to that object.

assignField

public void assignField(Compilation comp)

load

public void load(Compilation comp)

compileStore

public void compileStore(Compilation comp)

getValue

public final Expression getValue()

setFlag

public final void setFlag(boolean setting,
                          int flag)

isPublic

public final boolean isPublic()

isPrivate

public final boolean isPrivate()

setPrivate

public final void setPrivate(boolean isPrivate)

isFluid

public final boolean isFluid()
True if this is a fluid binding (in a FluidLetExp).

setFluid

public final void setFluid(boolean fluid)

isProcedureDecl

public final boolean isProcedureDecl()

setProcedureDecl

public final void setProcedureDecl(boolean val)

isIndirectBinding

public final boolean isIndirectBinding()
True if the value of the variable is the contents of a Binding.

setIndirectBinding

public final void setIndirectBinding(boolean indirectBinding)

getCanRead

public final boolean getCanRead()

setCanRead

public final void setCanRead(boolean read)

getCanCall

public final boolean getCanCall()

setCanCall

public final void setCanCall(boolean called)

getCanWrite

public final boolean getCanWrite()

setCanWrite

public final void setCanWrite(boolean written)

setName

public void setName(java.lang.String name)

ignorable

public boolean ignorable()
True if we never need to access this declaration.

isStatic

public boolean isStatic()

isLexical

public final boolean isLexical()

noteValue

public void noteValue(Expression value)

pushIndirectBinding

public void pushIndirectBinding(Compilation comp)
Create a Binding object, given that isIndirectBinding(). Assume the initial value is already pushed on the stack; leaves initialized Binding object on stack.

allocateVariable

public final Variable allocateVariable(CodeAttr code)

initBinding

public void initBinding(Compilation comp)
Generate code to initialize the location for this. Assume the initial value is already pushed on the stack.

setFile

public final void setFile(java.lang.String filename)

setLine

public final void setLine(int lineno,
                          int colno)

setLine

public final void setLine(int lineno)

getFile

public final java.lang.String getFile()

getLine

public final int getLine()
Get the line number of (the start of) this Expression. The "first" line is line 1.

getColumn

public final int getColumn()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object