MCPcopy Index your code
hub / github.com/clojure/clojure / emitMethods

Method emitMethods

src/jvm/clojure/lang/Compiler.java:8878–8916  ·  view source on GitHub ↗
(ClassVisitor cv)

Source from the content-addressed store, hash-verified

8876 }
8877
8878 protected void emitMethods(ClassVisitor cv){
8879 for(ISeq s = RT.seq(methods); s != null; s = s.next())
8880 {
8881 ObjMethod method = (ObjMethod) s.first();
8882 method.emit(this, cv);
8883 }
8884 //emit bridge methods
8885 for(Map.Entry<IPersistentVector,Set<Class>> e : covariants.entrySet())
8886 {
8887 java.lang.reflect.Method m = mmap.get(e.getKey());
8888 Class[] params = m.getParameterTypes();
8889 Type[] argTypes = new Type[params.length];
8890
8891 for(int i = 0; i < params.length; i++)
8892 {
8893 argTypes[i] = Type.getType(params[i]);
8894 }
8895
8896 Method target = new Method(m.getName(), Type.getType(m.getReturnType()), argTypes);
8897
8898 for(Class retType : e.getValue())
8899 {
8900 Method meth = new Method(m.getName(), Type.getType(retType), argTypes);
8901
8902 GeneratorAdapter gen = new GeneratorAdapter(ACC_PUBLIC + ACC_BRIDGE,
8903 meth,
8904 null,
8905 //todo don't hardwire this
8906 EXCEPTION_TYPES,
8907 cv);
8908 gen.visitCode();
8909 gen.loadThis();
8910 gen.loadArgs();
8911 gen.invokeInterface(Type.getType(m.getDeclaringClass()),target);
8912 gen.returnValue();
8913 gen.endMethod();
8914 }
8915 }
8916 }
8917
8918 static public IPersistentVector msig(java.lang.reflect.Method m){
8919 return RT.vector(m.getName(), RT.seq(m.getParameterTypes()),m.getReturnType());

Callers

nothing calls this directly

Calls 15

seqMethod · 0.95
nextMethod · 0.95
firstMethod · 0.95
emitMethod · 0.95
getTypeMethod · 0.95
loadThisMethod · 0.95
loadArgsMethod · 0.95
invokeInterfaceMethod · 0.95
returnValueMethod · 0.95
endMethodMethod · 0.95
getMethod · 0.65
getNameMethod · 0.65

Tested by

no test coverage detected