public class Definition extends ProtoExpression
VOID_ASSIGNMENTS| Constructor and Description |
|---|
Definition(Symbol symbol,
Expression body) |
Definition(Tables tables,
java.lang.String symbol,
java.util.AbstractList args,
Expression body) |
Definition(Tables tables,
java.lang.String symbol,
java.util.AbstractList args,
Expression body,
boolean isField) |
Definition(Tables tables,
java.lang.String name,
Expression body) |
Definition(Tables tables,
java.lang.String symbol,
Expression body,
boolean isField) |
Definition(Tables tables,
java.lang.String symbol,
java.lang.String arg,
Expression body) |
| Modifier and Type | Method and Description |
|---|---|
DefinedEntry |
codeEntry() |
void |
compile(Compiler compiler)
Compiling a definition amounts to assigning a code array to the defined symbol
for its type and compiling its body into this code array.
|
Expression |
copy()
Returns a deep copy of this expression.
|
boolean |
isProjection() |
boolean |
isSetOnEvaluation() |
int |
numberOfSubexpressions()
Returns the number of subexpressions
|
void |
registerCodeEntry()
This method registers a definitively type-checked definition of a global symbol.
|
void |
setCheckedType()
This method sets the final unambiguously checked type of this expression, possibly
along with other final information that may be needed by the compiler for
generating code.
|
Definition |
setIsProjection() |
Definition |
setOnEvaluation() |
Expression |
setSubexpression(int n,
Expression expression)
Returns this expression after setting its n-th subexpression to the specified
expression; if there is no subexpression at the given position, this throws a
NoSuchSubexpressionException
|
Expression |
shiftOffsets(int intShift,
int realShift,
int objectShift,
int intDepth,
int realDepth,
int objectDepth)
This methods visits this expression shifting the offset of all the Locals it encounters by the specified amount (per
sort) as long as the offset it sees is referencing a parameter within the specified
scope depth (per sort); This method is used when the compiler needs to
synthesize an scope from an already typechecked expression (i.e., for
currying or un/boxing - e.g., see the pad method below).
|
Expression |
subexpression(int n)
Returns the n-th subexpression of this expression; if there is no subexpression
at the given position, this throws a NoSuchSubexpressionException
|
Symbol |
symbol() |
java.lang.String |
toString() |
void |
typeCheck(TypeChecker typeChecker)
This method type-checks this expression in the context of the specified
TypeChecker.
|
Expression |
typedCopy()
Returns a deep copy of this expression this and all its subexpressions share the
same type as their copy's counterparts.
|
checkedType, setCheckedType, setType, type, typeRefaddType, addTypes, boxSort, containsFreeName, enclosingScope, extent, getEnd, getStart, isConstant, isEquality, isFalse, isHiddenSlicing, isNull, isSelector, isSlicing, isTrue, isVoid, locationString, otherTypes, parameters, sanitizeNames, sanitizeSorts, setCheckedTypeLocked, setEnd, setExtent, setOtherTypes, setStart, shiftOffsets, sort, substitute, typeCheck, typeCheck, typeCheckLockedpublic Definition(Symbol symbol, Expression body)
public Definition(Tables tables, java.lang.String name, Expression body)
public Definition(Tables tables, java.lang.String symbol, java.lang.String arg, Expression body)
public Definition(Tables tables, java.lang.String symbol, java.util.AbstractList args, Expression body)
public Definition(Tables tables, java.lang.String symbol, Expression body, boolean isField)
public Definition(Tables tables, java.lang.String symbol, java.util.AbstractList args, Expression body, boolean isField)
public final Expression copy()
Expressioncopy in class Expressionpublic final Expression typedCopy()
ExpressiontypedCopy in class Expressionpublic final int numberOfSubexpressions()
ExpressionnumberOfSubexpressions in class Expressionpublic final Expression subexpression(int n) throws NoSuchSubexpressionException
Expressionsubexpression in class ExpressionNoSuchSubexpressionExceptionpublic final Expression setSubexpression(int n, Expression expression) throws NoSuchSubexpressionException
ExpressionsetSubexpression in class ExpressionNoSuchSubexpressionExceptionpublic final Symbol symbol()
public final boolean isProjection()
public final Definition setIsProjection()
public final void setCheckedType()
ExpressionsetCheckedType in class Expressionpublic final DefinedEntry codeEntry()
public final Definition setOnEvaluation()
public final boolean isSetOnEvaluation()
public final void registerCodeEntry()
throws DefinitionException
DefinitionExceptionpublic final void typeCheck(TypeChecker typeChecker) throws TypingErrorException
ExpressiontypeCheck in class ExpressionTypingErrorExceptionpublic final Expression shiftOffsets(int intShift, int realShift, int objectShift, int intDepth, int realDepth, int objectDepth)
ExpressionshiftOffsets in class Expressionpublic final void compile(Compiler compiler)
compile in class Expressionpublic final java.lang.String toString()
toString in class java.lang.Object