gnu.expr
Class QuoteExp

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.QuoteExp
All Implemented Interfaces:
Named, Printable, javax.xml.transform.SourceLocator, org.xml.sax.Locator

public class QuoteExp
extends Expression

An Expression that evaluates to a constant value.


Field Summary
static QuoteExp abstractExp
           
static QuoteExp classObjectExp
           
static int EXPLICITLY_TYPED
           
static QuoteExp falseExp
           
static QuoteExp nullExp
           
static int SHARED_CONSTANT
           
static QuoteExp trueExp
           
protected  Type type
           
static QuoteExp undefined_exp
           
static QuoteExp voidExp
           
 
Fields inherited from class gnu.expr.Expression
flags, NEXT_AVAIL_FLAG, noExpressions, VALIDATED
 
Fields inherited from class gnu.mapping.Procedure
compilerKey, validateApplyKey
 
Fields inherited from class gnu.mapping.PropertySet
nameKey
 
Constructor Summary
QuoteExp(java.lang.Object val)
           
QuoteExp(java.lang.Object val, Type type)
           
 
Method Summary
 void apply(CallContext ctx)
          Evaluate the expression.
 void compile(Compilation comp, Target target)
           
 Expression deepCopy(IdentityHashTable mapper)
           
static QuoteExp getInstance(java.lang.Object value)
           
static QuoteExp getInstance(java.lang.Object value, SourceLocator position)
           
 Type getRawType()
           
 Type getType()
          Return the Type used to represent the values of this Expression.
 java.lang.Object getValue()
           
 boolean isExplicitlyTyped()
           
 boolean isSharedConstant()
           
protected  boolean mustCompile()
           
 void print(OutPort out)
           
 void setType(Type type)
           
 boolean side_effects()
          True if evaluating may have side-effects.
 java.lang.String toString()
           
 Expression validateApply(ApplyExp exp, InlineCalls visitor, Type required, Declaration decl)
          Apply inlining transformations on a given ApplyExp.
 java.lang.Object valueIfConstant()
          Return value if it is constant, or null if non-constant or unknown.
protected
<R,D> R
visit(ExpVisitor<R,D> visitor, D d)
           
 
Methods inherited from class gnu.expr.Expression
apply0, compile, compile, compileButFirst, compileNotePosition, compileWithPosition, compileWithPosition, deepCopy, deepCopy, deepCopy, eval, eval, getColumnNumber, getFileName, getFlag, getFlags, getLineNumber, getPublicId, getSystemId, isSingleValue, isStableSourceLocation, makeWhile, match0, print, printLineColumn, setFile, setFlag, setFlag, setLine, setLine, setLine, setLine, setLocation, visitChildren
 
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, getReturnType, getSetter, getSourceLocation, isSideEffectFree, match1, match2, match3, match4, matchN, maxArgs, maxArgs, minArgs, minArgs, set0, set1, setN, setSetter, setSourceLocation
 
Methods inherited from class gnu.mapping.PropertySet
getName, getProperty, getSymbol, removeProperty, setName, setProperty, setProperty, setSymbol
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EXPLICITLY_TYPED

public static final int EXPLICITLY_TYPED
See Also:
Constant Field Values

SHARED_CONSTANT

public static final int SHARED_CONSTANT
See Also:
Constant Field Values

type

protected Type type

undefined_exp

public static QuoteExp undefined_exp

abstractExp

public static QuoteExp abstractExp

voidExp

public static QuoteExp voidExp

trueExp

public static QuoteExp trueExp

falseExp

public static QuoteExp falseExp

nullExp

public static QuoteExp nullExp

classObjectExp

public static final QuoteExp classObjectExp
Constructor Detail

QuoteExp

public QuoteExp(java.lang.Object val)

QuoteExp

public QuoteExp(java.lang.Object val,
                Type type)
Method Detail

getValue

public final java.lang.Object getValue()

valueIfConstant

public final java.lang.Object valueIfConstant()
Description copied from class: Expression
Return value if it is constant, or null if non-constant or unknown.

Overrides:
valueIfConstant in class Expression

getRawType

public final Type getRawType()

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

setType

public void setType(Type type)

isExplicitlyTyped

public boolean isExplicitlyTyped()

isSharedConstant

public boolean isSharedConstant()

getInstance

public static QuoteExp getInstance(java.lang.Object value)

getInstance

public static QuoteExp getInstance(java.lang.Object value,
                                   SourceLocator position)

mustCompile

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

apply

public void apply(CallContext ctx)
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

compile

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

deepCopy

public Expression deepCopy(IdentityHashTable mapper)
Overrides:
deepCopy in class Expression

visit

protected <R,D> R visit(ExpVisitor<R,D> visitor,
                        D d)
Overrides:
visit in class Expression

validateApply

public Expression validateApply(ApplyExp exp,
                                InlineCalls visitor,
                                Type required,
                                Declaration decl)
Description copied from class: Expression
Apply inlining transformations on a given ApplyExp. Assumes the ApplyExp's function is this expression, or can be optimized to this expression.

Overrides:
validateApply in class Expression
Parameters:
exp - an application whose function expression can be simplified to this expression.
visitor - the context for the current inlining pass
decl - if non-null, a Declaration bound to this expression.
Returns:
an Expression equivalent to the passed-in exp.

side_effects

public boolean side_effects()
Description copied from class: Expression
True if evaluating may have side-effects.

Overrides:
side_effects in class Expression

toString

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

print

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