public class ArrayExtension extends ProtoExpression
VOID_ASSIGNMENTS| Constructor and Description |
|---|
ArrayExtension(java.util.AbstractList elements,
java.util.AbstractList indices) |
| Modifier and Type | Method and Description |
|---|---|
void |
compile(Compiler compiler)
compile the elements
compile the size
if there is no index set constraint:
compile the indexable, if there is one
generate MAKE_[ARRAY,MAP]_[I,R,O]
if there is an index set constraint:
compile the index set
generate size tests and conversion check for index set
generate MAKE_ARRAY_[I,R,O] or SHUFFLE_MAP_[I,R,O] depending
on whether or not indexables have been reconciled with a permutation array
|
Expression |
copy()
Returns a deep copy of this expression.
|
Expression[] |
elements() |
Expression |
indexable() |
Expression |
indexSet() |
int |
numberOfSubexpressions()
Returns the number of subexpressions
|
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.
|
void |
setIndexSet(Expression indexSet) |
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
|
int |
size() |
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
|
java.lang.String |
toString() |
void |
typeCheck(TypeChecker typeChecker)
Typechecking proceeds as follows:
type-check all the elements to have the same type;
if there is no indexable (i.e., this is not a map)
force the indexer type to be int
else (i.e., this is a set-indexed map)
typecheck the indexable as a set
unify the indexable type and the indexer type
if there is an index set (i.e., this is constrained by an ArrayInitializer)
typecheck the index set to be a legal indexing type
unify the base type of the index set type with the indexable' base type if there is one
type-check this array extension as an array with the extension's element type
as array base type, and the array's indexer type as indexer type.
|
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, shiftOffsets, sort, substitute, typeCheck, typeCheck, typeCheckLockedpublic ArrayExtension(java.util.AbstractList elements,
java.util.AbstractList indices)
public final Expression copy()
Expressioncopy in class Expressionpublic final Expression typedCopy()
ExpressiontypedCopy in class Expressionpublic final void setIndexSet(Expression indexSet)
public final int size()
public 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 Expression[] elements()
public final Expression indexable()
public final Expression indexSet()
public final void setCheckedType()
ExpressionsetCheckedType in class Expressionpublic final void typeCheck(TypeChecker typeChecker) throws TypingErrorException
typeCheck in class ExpressionTypingErrorExceptionpublic final void compile(Compiler compiler)
compile in class Expressionpublic final java.lang.String toString()
toString in class java.lang.Object