1 package polyglot.ast; 2 3 import polyglot.types.*; 4 import java.util.List; 5 6 /** 7 * An <code>ArrayInit</code> is an immutable representation of 8 * an array initializer, such as { 3, 1, { 4, 1, 5 } }. Note that 9 * the elements of these array may be expressions of any type (e.g., 10 * <code>Call</code>). 11 */ 12 public interface ArrayInit extends Expr 13 { 14 /** 15 * Get the initializer elements. 16 * @return A list of {@link polyglot.ast.Expr Expr}. 17 */ 18 List elements(); 19 20 /** 21 * Set the initializer elements. 22 * @param elements A list of {@link polyglot.ast.Expr Expr}. 23 */ 24 ArrayInit elements(List elements); 25 26 /** 27 * Type check the individual elements of the array initializer against the 28 * left-hand-side type. Each element is checked to see if it can be 29 * assigned to a variable of type lhsType. 30 * @param lhsType Type to compare against. 31 * @exception SemanticException if there is a type error. 32 */ 33 void typeCheckElements(Type lhsType) throws SemanticException; 34 } 35