(ObjExpr fn, ClassVisitor cv)
| 6065 | } |
| 6066 | |
| 6067 | public void doEmitStatic(ObjExpr fn, ClassVisitor cv){ |
| 6068 | // System.out.println("emit static:" + fn.name); |
| 6069 | Type returnType = Type.getType(retClass); |
| 6070 | // if (retClass == double.class || retClass == long.class) |
| 6071 | // returnType = getReturnType(); |
| 6072 | // else returnType = OBJECT_TYPE; |
| 6073 | |
| 6074 | Method ms = new Method("invokeStatic", returnType, argtypes); |
| 6075 | |
| 6076 | GeneratorAdapter gen = new GeneratorAdapter(ACC_PUBLIC + ACC_STATIC, |
| 6077 | ms, |
| 6078 | null, |
| 6079 | //todo don't hardwire this |
| 6080 | EXCEPTION_TYPES, |
| 6081 | cv); |
| 6082 | gen.visitCode(); |
| 6083 | Label loopLabel = gen.mark(); |
| 6084 | gen.visitLineNumber(line, loopLabel); |
| 6085 | try |
| 6086 | { |
| 6087 | Var.pushThreadBindings(RT.map(LOOP_LABEL, loopLabel, METHOD, this)); |
| 6088 | emitBody(objx, gen, retClass, body); |
| 6089 | |
| 6090 | Label end = gen.mark(); |
| 6091 | for(ISeq lbs = argLocals.seq(); lbs != null; lbs = lbs.next()) |
| 6092 | { |
| 6093 | LocalBinding lb = (LocalBinding) lbs.first(); |
| 6094 | gen.visitLocalVariable(lb.name, argtypes[lb.idx].getDescriptor(), null, loopLabel, end, lb.idx); |
| 6095 | } |
| 6096 | } |
| 6097 | finally |
| 6098 | { |
| 6099 | Var.popThreadBindings(); |
| 6100 | } |
| 6101 | |
| 6102 | gen.returnValue(); |
| 6103 | //gen.visitMaxs(1, 1); |
| 6104 | gen.endMethod(); |
| 6105 | |
| 6106 | //generate the regular invoke, calling the static method |
| 6107 | Method m = new Method(getMethodName(), OBJECT_TYPE, getArgTypes()); |
| 6108 | |
| 6109 | gen = new GeneratorAdapter(ACC_PUBLIC, |
| 6110 | m, |
| 6111 | null, |
| 6112 | //todo don't hardwire this |
| 6113 | EXCEPTION_TYPES, |
| 6114 | cv); |
| 6115 | gen.visitCode(); |
| 6116 | for(int i = 0; i < argtypes.length; i++) |
| 6117 | { |
| 6118 | gen.loadArg(i); |
| 6119 | HostExpr.emitUnboxArg(fn, gen, argclasses[i]); |
| 6120 | if(!argclasses[i].isPrimitive()) |
| 6121 | { |
| 6122 | gen.visitInsn(Opcodes.ACONST_NULL); |
| 6123 | gen.storeArg(i); |
| 6124 | } |
no test coverage detected