( Object[] argValues, Interpreter interpreter, CallStack callstack, SimpleNode callerInfo, boolean overrideNameSpace )
| 261 | } |
| 262 | |
| 263 | private Object invokeImpl( |
| 264 | Object[] argValues, Interpreter interpreter, CallStack callstack, |
| 265 | SimpleNode callerInfo, boolean overrideNameSpace ) |
| 266 | throws EvalError |
| 267 | { |
| 268 | Class returnType = getReturnType(); |
| 269 | Class [] paramTypes = getParameterTypes(); |
| 270 | |
| 271 | // If null callstack |
| 272 | if ( callstack == null ) |
| 273 | callstack = new CallStack( declaringNameSpace ); |
| 274 | |
| 275 | if ( argValues == null ) |
| 276 | argValues = new Object [] { }; |
| 277 | |
| 278 | // Cardinality (number of args) mismatch |
| 279 | if ( argValues.length != numArgs ) |
| 280 | { |
| 281 | /* |
| 282 | // look for help string |
| 283 | try { |
| 284 | // should check for null namespace here |
| 285 | String help = |
| 286 | (String)declaringNameSpace.get( |
| 287 | "bsh.help."+name, interpreter ); |
| 288 | |
| 289 | interpreter.println(help); |
| 290 | return Primitive.VOID; |
| 291 | } catch ( Exception e ) { |
| 292 | throw eval error |
| 293 | } |
| 294 | */ |
| 295 | throw new EvalError( |
| 296 | "Wrong number of arguments for local method: " |
| 297 | + name, callerInfo, callstack ); |
| 298 | } |
| 299 | |
| 300 | // Make the local namespace for the method invocation |
| 301 | NameSpace localNameSpace; |
| 302 | if ( overrideNameSpace ) |
| 303 | localNameSpace = callstack.top(); |
| 304 | else |
| 305 | { |
| 306 | localNameSpace = new NameSpace( declaringNameSpace, name ); |
| 307 | localNameSpace.isMethod = true; |
| 308 | } |
| 309 | // should we do this for both cases above? |
| 310 | localNameSpace.setNode( callerInfo ); |
| 311 | |
| 312 | // set the method parameters in the local namespace |
| 313 | for(int i=0; i<numArgs; i++) |
| 314 | { |
| 315 | // Set typed variable |
| 316 | if ( paramTypes[i] != null ) |
| 317 | { |
| 318 | try { |
| 319 | argValues[i] = |
| 320 | //Types.getAssignableForm( argValues[i], paramTypes[i] ); |
no test coverage detected