(final CallStack callstack, final Interpreter interpreter)
| 59 | |
| 60 | |
| 61 | private Class<?> generateClass(final CallStack callstack, final Interpreter interpreter) throws EvalError { |
| 62 | int child = 0; |
| 63 | |
| 64 | // resolve superclass if any |
| 65 | Class superClass = null; |
| 66 | if ( extend ) { |
| 67 | BSHAmbiguousName superNode = (BSHAmbiguousName)jjtGetChild(child++); |
| 68 | superClass = superNode.toClass( callstack, interpreter ); |
| 69 | } |
| 70 | |
| 71 | // Get interfaces |
| 72 | Class [] interfaces = new Class[numInterfaces]; |
| 73 | for( int i=0; i<numInterfaces; i++) { |
| 74 | BSHAmbiguousName node = (BSHAmbiguousName)jjtGetChild(child++); |
| 75 | interfaces[i] = node.toClass(callstack, interpreter); |
| 76 | if ( !interfaces[i].isInterface() ) |
| 77 | throw new EvalError( |
| 78 | "Type: "+node.text+" is not an interface!", |
| 79 | this, callstack ); |
| 80 | } |
| 81 | |
| 82 | BSHBlock block; |
| 83 | // Get the class body BSHBlock |
| 84 | if ( child < jjtGetNumChildren() ) |
| 85 | block = (BSHBlock) jjtGetChild(child); |
| 86 | else |
| 87 | block = new BSHBlock( ParserTreeConstants.JJTBLOCK ); |
| 88 | |
| 89 | return ClassGenerator.getClassGenerator().generateClass( |
| 90 | name, modifiers, interfaces, superClass, block, isInterface, |
| 91 | callstack, interpreter ); |
| 92 | } |
| 93 | |
| 94 | |
| 95 | public String toString() { |
no test coverage detected