1 33 34 package bsh; 35 36 public class DelayedEvalBshMethod extends BshMethod 37 { 38 String returnTypeDescriptor; 39 BSHReturnType returnTypeNode; 40 String [] paramTypeDescriptors; 41 BSHFormalParameters paramTypesNode; 42 43 transient CallStack callstack; 45 transient Interpreter interpreter; 46 47 54 60 DelayedEvalBshMethod( 61 String name, 62 String returnTypeDescriptor, BSHReturnType returnTypeNode, 63 String [] paramNames, 64 String [] paramTypeDescriptors, BSHFormalParameters paramTypesNode, 65 BSHBlock methodBody, 66 NameSpace declaringNameSpace, Modifiers modifiers, 67 CallStack callstack, Interpreter interpreter 68 ) { 69 super( name, null, paramNames, null, 70 methodBody, declaringNameSpace, modifiers ); 71 72 this.returnTypeDescriptor = returnTypeDescriptor; 73 this.returnTypeNode = returnTypeNode; 74 this.paramTypeDescriptors = paramTypeDescriptors; 75 this.paramTypesNode = paramTypesNode; 76 this.callstack = callstack; 77 this.interpreter = interpreter; 78 } 79 80 public String getReturnTypeDescriptor() { return returnTypeDescriptor; } 81 82 public Class getReturnType() 83 { 84 if ( returnTypeNode == null ) 85 return null; 86 87 try { 89 return returnTypeNode.evalReturnType( callstack, interpreter ); 90 } catch ( EvalError e ) { 91 throw new InterpreterError("can't eval return type: "+e); 92 } 93 } 94 95 public String [] getParamTypeDescriptors() { return paramTypeDescriptors; } 96 97 public Class [] getParameterTypes() 98 { 99 try { 101 return (Class [])paramTypesNode.eval( callstack, interpreter ); 102 } catch ( EvalError e ) { 103 throw new InterpreterError("can't eval param types: "+e); 104 } 105 } 106 } 107 | Popular Tags |