( Object obj, CallStack callstack, Interpreter interpreter, SimpleNode callerInfo )
| 199 | /** |
| 200 | */ |
| 201 | static int getIndexAux( |
| 202 | Object obj, CallStack callstack, Interpreter interpreter, |
| 203 | SimpleNode callerInfo ) |
| 204 | throws EvalError |
| 205 | { |
| 206 | if ( !obj.getClass().isArray() ) |
| 207 | throw new EvalError("Not an array", callerInfo, callstack ); |
| 208 | |
| 209 | int index; |
| 210 | try { |
| 211 | Object indexVal = |
| 212 | ((SimpleNode)callerInfo.jjtGetChild(0)).eval( |
| 213 | callstack, interpreter ); |
| 214 | if ( !(indexVal instanceof Primitive) ) |
| 215 | indexVal = Types.castObject( |
| 216 | indexVal, Integer.TYPE, Types.ASSIGNMENT ); |
| 217 | index = ((Primitive)indexVal).intValue(); |
| 218 | } catch( UtilEvalError e ) { |
| 219 | Interpreter.debug("doIndex: "+e); |
| 220 | throw e.toEvalError( |
| 221 | "Arrays may only be indexed by integer types.", |
| 222 | callerInfo, callstack ); |
| 223 | } |
| 224 | |
| 225 | return index; |
| 226 | } |
| 227 | |
| 228 | /** |
| 229 | array index. |
no test coverage detected