public class NewArray extends ProtoExpression
VOID_ASSIGNMENTS| Constructor and Description |
|---|
NewArray(Type baseType,
java.util.AbstractList dimension) |
NewArray(Type baseType,
Expression[] dimension) |
| Modifier and Type | Method and Description |
|---|---|
Type |
baseType() |
void |
compile(Compiler compiler)
To compile a new array, we:
compile the last dimension,
generate a PUSH_[ARRAY,MAP]_[I,R,O] instruction,
compile the next to last dimension,
generate a FILL_[ARRAY,MAP]_[I,R,O][AM] instruction,
compile each of the other dimensions followed with a FILL_[ARRAY,MAP]_O[A,M]
instruction.
|
Expression |
copy()
Returns a deep copy of this expression.
|
Expression[] |
dimension() |
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.
|
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 |
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)
To typecheck a new array, we typecheck:
each dimension to have an allowed index set type (i.e., int,
int range, or set),
this as an array type with the base type and dimension types.
|
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 NewArray(Type baseType, Expression[] dimension)
public NewArray(Type baseType, java.util.AbstractList dimension)
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 Expression[] dimension()
public final Type baseType()
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