polyglot.ast
Interface ArrayInit

All Superinterfaces:
java.lang.Cloneable, Copy, Expr, JL, Node, NodeOps, Prefix, Receiver, Term, Typed
All Known Implementing Classes:
ArrayInit_c

public interface ArrayInit
extends Expr

An ArrayInit is an immutable representation of an array initializer, such as { 3, 1, { 4, 1, 5 } }. Note that the elements of these array may be expressions of any type (e.g., Call).


Method Summary
 java.util.List elements()
          Get the initializer elements.
 ArrayInit elements(java.util.List elements)
          Set the initializer elements.
 void typeCheckElements(Type lhsType)
          Type check the individual elements of the array initializer against the left-hand-side type.
 
Methods inherited from interface polyglot.ast.Expr
constantValue, isConstant, precedence, printSubExpr, printSubExpr, type
 
Methods inherited from interface polyglot.ast.Node
childExpectedType, del, del, dump, ext, ext, ext, ext, position, position, visit, visitChild, visitEdge, visitList
 
Methods inherited from interface polyglot.ast.JL
init, node
 
Methods inherited from interface polyglot.ast.NodeOps
addDecls, addMembers, addMembersEnter, buildTypes, buildTypesEnter, disambiguate, disambiguateEnter, enterScope, enterScope, exceptionCheck, exceptionCheckEnter, prettyPrint, throwTypes, translate, typeCheck, typeCheckEnter, visitChildren
 
Methods inherited from interface polyglot.util.Copy
copy
 
Methods inherited from interface polyglot.ast.Typed
type
 
Methods inherited from interface polyglot.ast.Term
acceptCFG, entry, exceptions, exceptions, reachable, reachable
 

Method Detail

elements

java.util.List elements()
Get the initializer elements.

Returns:
A list of Expr.

elements

ArrayInit elements(java.util.List elements)
Set the initializer elements.

Parameters:
elements - A list of Expr.

typeCheckElements

void typeCheckElements(Type lhsType)
                       throws SemanticException
Type check the individual elements of the array initializer against the left-hand-side type. Each element is checked to see if it can be assigned to a variable of type lhsType.

Parameters:
lhsType - Type to compare against.
Throws:
SemanticException - if there is a type error.