jltools.ext.jl.ast
Class NewArray_c
java.lang.Object
|
+--jltools.ext.jl.ast.Node_c
|
+--jltools.ext.jl.ast.Expr_c
|
+--jltools.ext.jl.ast.NewArray_c
- All Implemented Interfaces:
- java.lang.Cloneable, Copy, Expr, NewArray, Node, Prefix, Receiver, java.io.Serializable, Typed
- public class NewArray_c
- extends Expr_c
- implements NewArray
A NewArray
represents a new array expression such as new
File[8][] { null }
. It consists of an element type (e.g.,
File
), a list of dimension expressions (e.g., 8), 0 or more
additional dimensions (e.g., 1 for []), and an array initializer. The
dimensions of the array initializer must equal the number of additional "[]"
dimensions.
- See Also:
- Serialized Form
Fields inherited from class jltools.ext.jl.ast.Expr_c |
type |
Methods inherited from class jltools.ext.jl.ast.Node_c |
buildTypes, buildTypesOverride_, buildTypesOverride, copy, disambiguate_, disambiguate, disambiguateOverride_, disambiguateOverride, disambiguateTypes_, disambiguateTypes, disambiguateTypesOverride_, disambiguateTypesOverride, enterScope, exceptionCheck_, exceptionCheck, exceptionCheckOverride_, exceptionCheckOverride, ext, ext, foldConstants_, foldConstants, foldConstantsOverride_, foldConstantsOverride, leaveScope, position, position, reconstructTypes, translate, translateBlock, translateSubstmt, typeCheck, typeCheckOverride_, typeCheckOverride, visit, visitList |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface jltools.ast.Node |
buildTypes_, buildTypesOverride_, copy, disambiguate_, disambiguateOverride_, disambiguateTypes_, disambiguateTypesOverride_, dump, enterScope, exceptionCheck_, exceptionCheckOverride_, ext, ext, foldConstants_, foldConstantsOverride_, leaveScope, position, position, reconstructTypes_, typeCheckOverride_, visit |
Methods inherited from interface jltools.ast.Typed |
type |
baseType
protected TypeNode baseType
dims
protected java.util.List dims
addDims
protected int addDims
init
protected ArrayInit init
NewArray_c
public NewArray_c(Ext ext,
Position pos,
TypeNode baseType,
java.util.List dims,
int addDims,
ArrayInit init)
baseType
public TypeNode baseType()
- Get the base type node of the expression.
- Specified by:
baseType
in interface NewArray
baseType
public NewArray baseType(TypeNode baseType)
- Set the base type node of the expression.
- Specified by:
baseType
in interface NewArray
dims
public java.util.List dims()
- Get the dimension expressions of the expression.
- Specified by:
dims
in interface NewArray
dims
public NewArray dims(java.util.List dims)
- Set the dimension expressions of the expression.
- Specified by:
dims
in interface NewArray
numDims
public int numDims()
- Get the number of dimensions of the expression.
- Specified by:
numDims
in interface NewArray
additionalDims
public int additionalDims()
- Get the number of additional dimensions of the expression.
- Specified by:
additionalDims
in interface NewArray
additionalDims
public NewArray additionalDims(int addDims)
- Set the number of additional dimensions of the expression.
- Specified by:
additionalDims
in interface NewArray
init
public ArrayInit init()
- Get the initializer of the expression.
- Specified by:
init
in interface NewArray
init
public NewArray init(ArrayInit init)
- Set the initializer of the expression.
- Specified by:
init
in interface NewArray
reconstruct
protected NewArray_c reconstruct(TypeNode baseType,
java.util.List dims,
ArrayInit init)
- Reconstruct the expression.
visitChildren
public Node visitChildren(NodeVisitor v)
- Visit the children of the expression.
- Specified by:
visitChildren
in interface Node
- Overrides:
visitChildren
in class Node_c
typeCheck_
public Node typeCheck_(TypeChecker tc)
throws SemanticException
- Type check the expression.
- Specified by:
typeCheck_
in interface Node
- Overrides:
typeCheck_
in class Node_c
toString
public java.lang.String toString()
- Overrides:
toString
in class Node_c
translate_
public void translate_(CodeWriter w,
Translator tr)
- Write the expression to an output file.
- Specified by:
translate_
in interface Node
- Overrides:
translate_
in class Node_c
- Following copied from interface:
jltools.ast.Node
- Parameters:
w
- The code writer to which to write.tr
- The translation pass. This is not a visitor.