@return the result of the cast.
( CallStack callstack, Interpreter interpreter )
| 41 | @return the result of the cast. |
| 42 | */ |
| 43 | public Object eval( |
| 44 | CallStack callstack, Interpreter interpreter ) throws EvalError |
| 45 | { |
| 46 | NameSpace namespace = callstack.top(); |
| 47 | Class toType = ((BSHType)jjtGetChild(0)).getType( |
| 48 | callstack, interpreter ); |
| 49 | SimpleNode expression = (SimpleNode)jjtGetChild(1); |
| 50 | |
| 51 | // evaluate the expression |
| 52 | Object fromValue = expression.eval(callstack, interpreter); |
| 53 | Class fromType = fromValue.getClass(); |
| 54 | |
| 55 | // TODO: need to add isJavaCastable() test for strictJava |
| 56 | // (as opposed to isJavaAssignable()) |
| 57 | try { |
| 58 | return Types.castObject( fromValue, toType, Types.CAST ); |
| 59 | } catch ( UtilEvalError e ) { |
| 60 | throw e.toEvalError( this, callstack ); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | } |
nothing calls this directly
no test coverage detected