public Object eval( CallStack callstack, Interpreter interpreter ) throws EvalError { throw new InterpreterError( "Don't know how to eval an ambiguous name!" +" Use toObject() if you want an object." ); }
@Override public Object visit(BSHArrayInitializer node) { throw new InterpreterError( "Unimplemented or inappropriate for BSHArrayInitializer class."); }
@Override public Object visit(BSHFormalComment node) { throw new InterpreterError( "Unimplemented or inappropriate for BSHFormalComment class."); }
@Override public Object visit(BSHType node) { throw new InterpreterError( "Unimplemented or inappropriate for BSHType class.", node); }
@Override public Object visit(BSHAmbiguousName node) { throw new InterpreterError( "Don't know how to eval an ambiguous name!" +" Use toObject() if you want an object." ); }
@Override public Object visit(BSHArguments node) { throw new InterpreterError( "Unimplemented or inappropriate for BSHArguments class."); }
@Override public Object visit(BSHLiteral node) { if (node.value == null) throw new InterpreterError("Null in bsh literal: "+node.value); return node.value; }
@Override public Object visit(BSHVariableDeclarator node) { throw new InterpreterError( "Unimplemented or inappropriate for BSHVariableDeclarator class."); }
private Object completeRound( String lastEvalName, String nextEvalName, Object returnObject ) { if ( returnObject == null ) throw new InterpreterError("lastEvalName = "+lastEvalName); this.lastEvalName = lastEvalName; this.evalName = nextEvalName; this.evalBaseObject = returnObject; return returnObject; }
/** Return the primitive value stored in its java.lang wrapper class */ public Object getValue() { if ( value == Special.NULL_VALUE ) return null; if ( value == Special.VOID_TYPE ) throw new InterpreterError("attempt to unwrap void type"); return value; }
public NameSpace pop() { try { return stack.pop(); } catch(EmptyStackException e) { throw new InterpreterError("pop on empty CallStack"); } }
/** This is the general signature for evaluation of a node. */ public Object eval( CallStack callstack, Interpreter interpreter ) throws EvalError { throw new InterpreterError( "Unimplemented or inappropriate for " + getClass().getName() ); }
public Primitive( Object value ) { if ( value == null ) throw new InterpreterError( "Use Primitve.NULL instead of Primitive(null)"); if ( value != Special.NULL_VALUE && value != Special.VOID_TYPE && !isWrapperType( value.getClass() ) ) throw new InterpreterError( "Not a wrapper type: "+value); this.value = value; }
private Primitive( Object value ) { if ( value == null ) throw new InterpreterError( "Use Primitve.NULL instead of Primitive(null)"); if ( value != Special.NULL_VALUE && value != Special.VOID_TYPE && !isWrapperType( value.getClass() ) ) throw new InterpreterError( "Not a wrapper type: "+value.getClass()); this.value = value; }
/** Unchecked get for internal use */ Object getu( String name ) { try { return get( name ); } catch ( EvalError e ) { throw new InterpreterError("set: "+e, e); } }
public Class<?> getReturnType() { if ( returnTypeNode == null ) return null; // BSHType will cache the type for us try { return returnTypeNode.evalReturnType( callstack, interpreter ); } catch ( EvalError e ) { throw new InterpreterError("can't eval return type: "+e, e); } }
/** Unchecked set for internal use */ void setu(String name, Object value) { try { set(name, value); } catch ( EvalError e ) { throw new InterpreterError("set: "+e); } }
/** * Get the static bsh namespace field from the class. * @param className may be the name of clas itself or a superclass of clas. */ public static This getClassStaticThis(Class<?> clas, String className) { try { return (This) getStaticFieldValue(clas, BSHSTATIC + className); } catch (Exception e) { throw new InterpreterError("Unable to get class static space: " + e, e); } }
public static NameSpace getThisNS(Class<?> type) { if (!isGeneratedClass(type)) return null; try { return getClassStaticThis(type, type.getSimpleName()).namespace; } catch (Exception e) { if (e.getCause() instanceof UtilTargetError) throw new InterpreterError(e.getCause().getCause().getMessage(), e.getCause().getCause()); return null; } }
public Class<?>[] getParameterTypes() { if ( null != this.constructor ) return this.constructor.getParameterTypes(); // BSHFormalParameters will cache the type for us try { return (Class [])paramTypesNode.eval( callstack, interpreter ); } catch ( EvalError e ) { throw new InterpreterError("can't eval param types: "+e, e); } }