gnu.expr
Class SetExp

java.lang.Object
  extended by gnu.mapping.PropertySet
      extended by gnu.mapping.Procedure
          extended by gnu.mapping.Procedure0
              extended by gnu.expr.Expression
                  extended by gnu.expr.AccessExp
                      extended by gnu.expr.SetExp
All Implemented Interfaces:
Named, Printable, SourceLocator, org.xml.sax.Locator

public class SetExp
extends AccessExp

An Expression to set (bind) or define a new value to a named variable.


Field Summary
static int DEFINING_FLAG
           
static int GLOBAL_FLAG
           
static int HAS_VALUE
           
static int PREFER_BINDING2
           
static int PROCEDURE
           
static int SET_IF_UNBOUND
           
 
Fields inherited from class gnu.expr.Expression
flags, NEXT_AVAIL_FLAG, noExpressions
 
Constructor Summary
SetExp(Declaration decl, Expression val)
           
SetExp(java.lang.Object symbol, Expression val)
           
 
Method Summary
 void apply(CallContext ctx)
          Evaluate the expression.
 void compile(Compilation comp, Target target)
           
 boolean getHasValue()
          True if evaluating the SetExp yields the value of the RHS.
 Expression getNewValue()
          Get the Expression for calculating the new ("right-hand") value.
 Type getType()
          Return the Type used to represent the values of this Expression.
 boolean isDefining()
           
 boolean isFuncDef()
          True if this is a functon definition ("defun").
 boolean isSetIfUnbound()
           
static SetExp makeDefinition(Declaration decl, Expression val)
           
static SetExp makeDefinition(java.lang.Object symbol, Expression val)
           
protected  boolean mustCompile()
           
 void print(OutPort out)
           
 void setDefining(boolean value)
           
 void setFuncDef(boolean value)
           
 void setHasValue(boolean value)
           
 void setSetIfUnbound(boolean value)
           
 java.lang.String toString()
           
protected  Expression walk(ExpWalker walker)
           
protected  void walkChildren(ExpWalker walker)
           
 
Methods inherited from class gnu.expr.AccessExp
contextDecl, getBinding, getName, getSimpleName, getSymbol, setBinding, setContextDecl, string_name
 
Methods inherited from class gnu.expr.Expression
apply0, compile, compile, compileButFirst, compileNotePosition, compileWithPosition, compileWithPosition, eval, eval, getColumnNumber, getFileName, getFlag, getFlags, getLineNumber, getPublicId, getSystemId, inline, isStableSourceLocation, makeWhile, match0, print, printLineColumn, setFile, setFlag, setFlag, setLine, setLine, setLine, setLine, setLocation, side_effects, valueIfConstant
 
Methods inherited from class gnu.mapping.Procedure0
apply1, apply2, apply3, apply4, applyN, numArgs
 
Methods inherited from class gnu.mapping.Procedure
apply, check0, check1, check2, check3, check4, checkArgCount, checkN, getSetter, getSourceLocation, match1, match2, match3, match4, matchN, maxArgs, minArgs, set0, set1, setN, setSetter, setSourceLocation
 
Methods inherited from class gnu.mapping.PropertySet
getProperty, removeProperty, setName, setProperty, setProperty, setSymbol
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFINING_FLAG

public static final int DEFINING_FLAG
See Also:
Constant Field Values

GLOBAL_FLAG

public static final int GLOBAL_FLAG
See Also:
Constant Field Values

PREFER_BINDING2

public static final int PREFER_BINDING2
See Also:
Constant Field Values

PROCEDURE

public static final int PROCEDURE
See Also:
Constant Field Values

SET_IF_UNBOUND

public static final int SET_IF_UNBOUND
See Also:
Constant Field Values

HAS_VALUE

public static final int HAS_VALUE
See Also:
Constant Field Values
Constructor Detail

SetExp

public SetExp(java.lang.Object symbol,
              Expression val)

SetExp

public SetExp(Declaration decl,
              Expression val)
Method Detail

makeDefinition

public static SetExp makeDefinition(java.lang.Object symbol,
                                    Expression val)

makeDefinition

public static SetExp makeDefinition(Declaration decl,
                                    Expression val)

getNewValue

public final Expression getNewValue()
Get the Expression for calculating the new ("right-hand") value.


isDefining

public final boolean isDefining()

setDefining

public final void setDefining(boolean value)

getHasValue

public final boolean getHasValue()
True if evaluating the SetExp yields the value of the RHS.


setHasValue

public final void setHasValue(boolean value)

isFuncDef

public final boolean isFuncDef()
True if this is a functon definition ("defun").


setFuncDef

public final void setFuncDef(boolean value)

isSetIfUnbound

public final boolean isSetIfUnbound()

setSetIfUnbound

public final void setSetIfUnbound(boolean value)

mustCompile

protected boolean mustCompile()
Specified by:
mustCompile in class Expression

apply

public void apply(CallContext ctx)
           throws java.lang.Throwable
Description copied from class: Expression
Evaluate the expression. This is named apply rather than eval so it is compatible with the full-tail-call calling convention, and we can stash an Expression in CallContext's proc field. FIXME - are we making use of this?

Overrides:
apply in class Expression
Throws:
java.lang.Throwable

compile

public void compile(Compilation comp,
                    Target target)
Specified by:
compile in class Expression

getType

public final Type getType()
Description copied from class: Expression
Return the Type used to represent the values of this Expression.

Overrides:
getType in class Expression

walk

protected Expression walk(ExpWalker walker)
Overrides:
walk in class Expression

walkChildren

protected void walkChildren(ExpWalker walker)
Overrides:
walkChildren in class Expression

print

public void print(OutPort out)
Specified by:
print in class Expression

toString

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