gnu.expr

Class ReferenceExp

Implemented Interfaces:
org.xml.sax.Locator, Named, Printable, SourceLocator
Known Direct Subclasses:
ThisExp

public class ReferenceExp
extends AccessExp

This class represents a variable reference (an identifier).

Field Summary

static int
CREATE_FIELD_REFERENCE
Create a FieldLocation referencing the binding.
static int
DONT_DEREFERENCE
static int
PREFER_BINDING2
static int
PROCEDURE_NAME

Fields inherited from class gnu.expr.Expression

NEXT_AVAIL_FLAG, flags, noExpressions

Constructor Summary

ReferenceExp(Object symbol)
ReferenceExp(Object symbol, Declaration binding)
ReferenceExp(Declaration binding)

Method Summary

void
apply(CallContext ctx)
Evaluate the expression.
void
compile(Compilation comp, Target target)
boolean
getDontDereference()
Type
getType()
Return the Type used to represent the values of this Expression.
Expression
inline(ApplyExp exp, InlineCalls walker, Declaration decl)
Apply inlining transformations on a given ApplyExp.
boolean
isProcedureName()
True if this identifier appears in "function call position".
boolean
isUnknown()
protected boolean
mustCompile()
void
print(OutPort ps)
void
setDontDereference(boolean setting)
void
setProcedureName(boolean setting)
Note if this identifier appears in "function call position".
boolean
side_effects()
True if evaluating may have side-effects.
String
toString()
protected Expression
walk(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

CREATE_FIELD_REFERENCE

public static final int CREATE_FIELD_REFERENCE
Create a FieldLocation referencing the binding.
Field Value:
8

DONT_DEREFERENCE

public static final int DONT_DEREFERENCE
Field Value:
1

PREFER_BINDING2

public static final int PREFER_BINDING2
Field Value:
4

PROCEDURE_NAME

public static final int PROCEDURE_NAME
Field Value:
2

Constructor Details

ReferenceExp

public ReferenceExp(Object symbol)

ReferenceExp

public ReferenceExp(Object symbol,
                    Declaration binding)

ReferenceExp

public ReferenceExp(Declaration binding)

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

getDontDereference

public final boolean getDontDereference()

getType

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

inline

public Expression inline(ApplyExp exp,
                         InlineCalls walker,
                         Declaration decl)
Apply inlining transformations on a given ApplyExp. Assumes the ApplyExp's function is the this expression, or can be optimized to this expression.
Overrides:
inline in interface Expression
Parameters:
exp - an application whose function expression can be simplified to this expression.
walker - the context for the current inlining pass
decl - if non-null, a Declaration bound to this expression
Returns:
an Expression equivalent to te passed-in exp.

isProcedureName

public final boolean isProcedureName()
True if this identifier appears in "function call position". If so, it should be interpreted as a function name, which makes a difference for languages (like Common Lisp) that have two name spaces.

isUnknown

public final boolean isUnknown()

mustCompile

protected boolean mustCompile()
Overrides:
mustCompile in interface Expression

print

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

setDontDereference

public final void setDontDereference(boolean setting)

setProcedureName

public final void setProcedureName(boolean setting)
Note if this identifier appears in "function call position".

side_effects

public boolean side_effects()
True if evaluating may have side-effects.
Overrides:
side_effects in interface Expression

toString

public String toString()
Overrides:
toString in interface Expression

walk

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