Item makeNewArray ( DiagnosticPosition pos , Type type , int ndims ) { Type elemtype = types . elemtype ( type ) ; if ( types . dimensions ( type ) > ClassFile . MAX_DIMENSIONS ) { log . error ( pos , "limit.dimensions" ) ; nerrs ++ ; } int elemcode = Code . arraycode ( elemtype ) ; if ( elemcode == 0 || ( elemcode == 1 && ndims == 1 ) ) { code . emitAnewarray ( makeRef ( pos , elemtype ) , type ) ; } else if ( elemcode == 1 ) { code . emitMultianewarray ( ndims , makeRef ( pos , type ) , type ) ; } else { code . emitNewarray ( elemcode , type ) ; } return items . makeStackItem ( type ) ; }
Generate code to create an array with given element type and number of dimensions .