/** Generate code for an array literal. */
@Override
public Value visitArrayLiteral(ArrayLiteral nd) {
Type elttp = SootTypeUtil.getSootType(nd.getElement(0).type());
// create a new array with the appropriate number of elements
Value array = wrap(Jimple.v().newNewArrayExpr(elttp, IntConstant.v(nd.getNumElement())));
for(int i=0;i<nd.getNumElement();++i) {
// generate code to store the individual expressions into the elements of the array
Value elt = wrap(nd.getElement(i).accept(this));
units.add(Jimple.v().newAssignStmt(Jimple.v().newArrayRef(array, IntConstant.v(i)), elt));
}
return array;
}