(ClassVisitor cv)
| 8797 | } |
| 8798 | |
| 8799 | protected void emitStatics(ClassVisitor cv) { |
| 8800 | if(this.isDeftype()) |
| 8801 | { |
| 8802 | //getBasis() |
| 8803 | Method meth = Method.getMethod("clojure.lang.IPersistentVector getBasis()"); |
| 8804 | GeneratorAdapter gen = new GeneratorAdapter(ACC_PUBLIC + ACC_STATIC, |
| 8805 | meth, |
| 8806 | null, |
| 8807 | null, |
| 8808 | cv); |
| 8809 | emitValue(hintedFields, gen); |
| 8810 | gen.returnValue(); |
| 8811 | gen.endMethod(); |
| 8812 | |
| 8813 | if (this.isDeftype() && this.fields.count() > this.hintedFields.count()) |
| 8814 | { |
| 8815 | //create(IPersistentMap) |
| 8816 | String className = name.replace('.', '/'); |
| 8817 | int i = 1; |
| 8818 | int fieldCount = hintedFields.count(); |
| 8819 | |
| 8820 | MethodVisitor mv = cv.visitMethod(ACC_PUBLIC + ACC_STATIC, "create", "(Lclojure/lang/IPersistentMap;)L"+className+";", null, null); |
| 8821 | mv.visitCode(); |
| 8822 | |
| 8823 | for(ISeq s = RT.seq(hintedFields); s!=null; s=s.next(), i++) |
| 8824 | { |
| 8825 | String bName = ((Symbol)s.first()).name; |
| 8826 | Class k = tagClass(tagOf(s.first())); |
| 8827 | |
| 8828 | mv.visitVarInsn(ALOAD, 0); |
| 8829 | mv.visitLdcInsn(bName); |
| 8830 | mv.visitMethodInsn(INVOKESTATIC, "clojure/lang/Keyword", "intern", "(Ljava/lang/String;)Lclojure/lang/Keyword;"); |
| 8831 | mv.visitInsn(ACONST_NULL); |
| 8832 | mv.visitMethodInsn(INVOKEINTERFACE, "clojure/lang/IPersistentMap", "valAt", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); |
| 8833 | if(k.isPrimitive()) |
| 8834 | { |
| 8835 | mv.visitTypeInsn(CHECKCAST, Type.getType(boxClass(k)).getInternalName()); |
| 8836 | } |
| 8837 | mv.visitVarInsn(ASTORE, i); |
| 8838 | mv.visitVarInsn(ALOAD, 0); |
| 8839 | mv.visitLdcInsn(bName); |
| 8840 | mv.visitMethodInsn(INVOKESTATIC, "clojure/lang/Keyword", "intern", "(Ljava/lang/String;)Lclojure/lang/Keyword;"); |
| 8841 | mv.visitMethodInsn(INVOKEINTERFACE, "clojure/lang/IPersistentMap", "without", "(Ljava/lang/Object;)Lclojure/lang/IPersistentMap;"); |
| 8842 | mv.visitVarInsn(ASTORE, 0); |
| 8843 | } |
| 8844 | |
| 8845 | mv.visitTypeInsn(Opcodes.NEW, className); |
| 8846 | mv.visitInsn(DUP); |
| 8847 | |
| 8848 | Method ctor = new Method("<init>", Type.VOID_TYPE, ctorTypes()); |
| 8849 | |
| 8850 | if(hintedFields.count() > 0) |
| 8851 | for(i=1; i<=fieldCount; i++) |
| 8852 | { |
| 8853 | mv.visitVarInsn(ALOAD, i); |
| 8854 | Class k = tagClass(tagOf(hintedFields.nth(i-1))); |
| 8855 | if(k.isPrimitive()) |
| 8856 | { |
nothing calls this directly
no test coverage detected