Package gnu.expr
Class SetExp
-
- All Implemented Interfaces:
gnu.kawa.format.Printable,Named,SourceLocator,SourceLocator,Locator
public class SetExp extends AccessExp
An Expression to set (bind) or define a new value to a named variable.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface gnu.text.SourceLocator
SourceLocator.Simple
-
-
Field Summary
Fields Modifier and Type Field Description static intBAD_SHORT"Failure" return value of canUseInc.static intDEFINING_FLAGstatic intGLOBAL_FLAGstatic intHAS_VALUEstatic intPROCEDUREstatic intSET_IF_UNBOUND-
Fields inherited from class gnu.expr.AccessExp
NEXT_AVAIL_FLAG, PREFER_BINDING2
-
Fields inherited from class gnu.expr.Expression
applyMethodExpression, flags, noExpressions, type, VALIDATED
-
Fields inherited from class gnu.mapping.Procedure
applyMethodType, applyToConsumerDefault, applyToConsumerMethod, applyToObjectDefault, applyToObjectMethod, compilerKey, compilerXKey, inlineIfConstantSymbol, validateApplyKey, validateXApplyKey
-
Fields inherited from class gnu.mapping.PropertySet
nameKey
-
-
Constructor Summary
Constructors Constructor Description SetExp(Declaration decl, Expression val)SetExp(Object symbol, Expression val)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(CallContext ctx)Evaluate the expression.protected TypecalculateType()static intcanUseInc(Expression rhs, Declaration target)voidcompile(Compilation comp, Target target)booleangetHasValue()True if evaluating the SetExp yields the value of the RHS.ExpressiongetNewValue()Get the Expression for calculating the new ("right-hand") value.booleanisDefining()booleanisFuncDef()True if this is a functon definition ("defun").booleanisSetIfUnbound()static SetExpmakeDefinition(Declaration decl, Expression val)static SetExpmakeDefinition(Object symbol, Expression val)protected booleanmustCompile()voidprint(gnu.kawa.io.OutPort out)voidsetDefining(boolean value)voidsetFuncDef(boolean value)voidsetHasValue(boolean value)voidsetNewValue(Expression newValue)voidsetSetIfUnbound(boolean value)StringtoString()protected <R,D>
Rvisit(ExpVisitor<R,D> visitor, D d)protected <R,D>
voidvisitChildren(ExpVisitor<R,D> visitor, D d)-
Methods inherited from class gnu.expr.AccessExp
contextDecl, getBinding, getName, getSimpleName, getSymbol, setBinding, setContextDecl, string_name
-
Methods inherited from class gnu.expr.Expression
applyMethodExpression, checkLiteralKeyword, compile, compile, compileWithPosition, compileWithPosition, deepCopy, deepCopy, deepCopy, deepCopy, eval, eval, getColumnNumber, getEndColumn, getEndLine, getFileName, getFlag, getFlags, getLineNumber, getPublicId, getStartColumn, getStartLine, getSystemId, getType, getTypeRaw, isSingleValue, isStableSourceLocation, makeWhile, maybeSetLine, neverReturns, numArgs, print, printLineColumn, setFile, setFlag, setFlag, setLine, setLine, setLine, setLine, setLine, setLocation, setType, side_effects, validateApply, valueIfConstant
-
Methods inherited from class gnu.mapping.Procedure
apply0, apply1, apply2, apply3, apply4, applyL, applyN, applyToConsumerDefault, applyToObjectDefault, checkArgCount, checkBadCode, getApplyMethod, getApplyToConsumerMethod, getApplyToObjectMethod, getReturnType, getSetter, getSourceLocation, isSideEffectFree, lookupApplyHandle, maxArgs, maxArgs, minArgs, minArgs, set0, set1, setN, setSetter, setSourceLocation
-
Methods inherited from class gnu.mapping.PropertySet
getProperty, removeProperty, setName, setProperty, setProperty, setSymbol
-
-
-
-
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
-
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
-
BAD_SHORT
public static final int BAD_SHORT
"Failure" return value of canUseInc.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SetExp
public SetExp(Object symbol, Expression val)
-
SetExp
public SetExp(Declaration decl, Expression val)
-
-
Method Detail
-
makeDefinition
public static SetExp makeDefinition(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.
-
setNewValue
public void setNewValue(Expression newValue)
-
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:
mustCompilein classExpression
-
apply
public void apply(CallContext ctx) throws Throwable
Description copied from class:ExpressionEvaluate 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:
applyin classExpression- Throws:
Throwable
-
compile
public void compile(Compilation comp, Target target)
- Specified by:
compilein classExpression
-
canUseInc
public static int canUseInc(Expression rhs, Declaration target)
-
calculateType
protected final Type calculateType()
- Overrides:
calculateTypein classExpression
-
visit
protected <R,D> R visit(ExpVisitor<R,D> visitor, D d)
- Overrides:
visitin classExpression
-
visitChildren
protected <R,D> void visitChildren(ExpVisitor<R,D> visitor, D d)
- Overrides:
visitChildrenin classExpression
-
print
public void print(gnu.kawa.io.OutPort out)
- Specified by:
printin classExpression
-
toString
public String toString()
- Overrides:
toStringin classExpression
-
-