gnu.expr

Class SetExp

Implemented Interfaces:
org.xml.sax.Locator, Named, Printable, SourceLocator

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

NEXT_AVAIL_FLAG, flags, noExpressions

Constructor Summary

SetExp(Object symbol, Expression val)
SetExp(Declaration decl, 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(Object symbol, Expression val)
static SetExp
makeDefinition(Declaration decl, 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)
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

apply, apply0, compile, compile, compile, compileButFirst, compileNotePosition, compileWithPosition, compileWithPosition, eval, eval, getColumnNumber, getFileName, getFlag, getFlags, getLineNumber, getPublicId, getSystemId, getType, inline, isStableSourceLocation, makeWhile, match0, mustCompile, print, print, printLineColumn, setFile, setFlag, setFlag, setLine, setLine, setLine, setLine, setLocation, side_effects, toString, valueIfConstant, walk, walkChildren

Methods inherited from class gnu.mapping.Procedure0

apply0, apply1, apply2, apply3, apply4, applyN, numArgs

Methods inherited from class gnu.mapping.Procedure

apply, apply, apply0, apply1, apply2, apply3, apply4, applyN, check0, check1, check2, check3, check4, checkArgCount, checkN, getSetter, getSourceLocation, match0, match1, match2, match3, match4, matchN, maxArgs, minArgs, numArgs, set0, set1, setN, setSetter, setSourceLocation, toString

Methods inherited from class gnu.mapping.PropertySet

getName, getProperty, getSymbol, removeProperty, setName, setProperty, setProperty, setSymbol

Field Details

DEFINING_FLAG

public static final int DEFINING_FLAG
Field Value:
1

GLOBAL_FLAG

public static final int GLOBAL_FLAG
Field Value:
2

HAS_VALUE

public static final int HAS_VALUE
Field Value:
32

PREFER_BINDING2

public static final int PREFER_BINDING2
Field Value:
4

PROCEDURE

public static final int PROCEDURE
Field Value:
8

SET_IF_UNBOUND

public static final int SET_IF_UNBOUND
Field Value:
16

Constructor Details

SetExp

public SetExp(Object symbol,
              Expression val)

SetExp

public SetExp(Declaration decl,
              Expression val)

Method Details

apply

public void apply(CallContext ctx)
            throws Throwable
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 interface Expression

compile

public void compile(Compilation comp,
                    Target target)
Overrides:
compile in interface Expression

getHasValue

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

getNewValue

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

getType

public final Type getType()
Return the Type used to represent the values of this Expression.
Overrides:
getType in interface Expression

isDefining

public final boolean isDefining()

isFuncDef

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

isSetIfUnbound

public final boolean isSetIfUnbound()

makeDefinition

public static SetExp makeDefinition(Object symbol,
                                    Expression val)

makeDefinition

public static SetExp makeDefinition(Declaration decl,
                                    Expression val)

mustCompile

protected boolean mustCompile()
Overrides:
mustCompile in interface Expression

print

public void print(OutPort out)
Overrides:
print in interface Expression

setDefining

public final void setDefining(boolean value)

setFuncDef

public final void setFuncDef(boolean value)

setHasValue

public final void setHasValue(boolean value)

setSetIfUnbound

public final void setSetIfUnbound(boolean value)

toString

public String toString()
Overrides:
toString in interface Expression

walk

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

walkChildren

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