1 33 34 35 package bsh; 36 37 41 class BSHVariableDeclarator extends SimpleNode 42 { 43 public String name; 45 46 BSHVariableDeclarator(int id) { super(id); } 47 48 62 public Object eval( 63 BSHType typeNode, CallStack callstack, Interpreter interpreter) 64 throws EvalError 65 { 66 Object value = null; 68 69 if ( jjtGetNumChildren() > 0 ) 70 { 71 SimpleNode initializer = (SimpleNode)jjtGetChild(0); 72 73 79 if ( (typeNode != null) 80 && initializer instanceof BSHArrayInitializer 81 ) 82 value = ((BSHArrayInitializer)initializer).eval( 83 typeNode.getBaseType(), typeNode.getArrayDims(), 84 callstack, interpreter); 85 else 86 value = initializer.eval( callstack, interpreter); 87 } 88 89 if ( value == Primitive.VOID ) 90 throw new EvalError("Void initializer.", this, callstack ); 91 92 return value; 93 } 94 95 public String toString() { return "BSHVariableDeclarator "+name; } 96 } 97 | Popular Tags |