Source:
<code>public void visit(ClazzNode clazzNode) { scope = clazzNode.getScope(); cn = clazzNode; blockCount = 0; cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES + ClassWriter.COMPUTE_MAXS); cw.visit(52, ACC_PUBLIC + ACC_SUPER, clazzNode.getName(), null, clazzNode.getSuperclass(), null); cw.visitInnerClass("org/twnc/runtime/BObject", "org/twnc/runtime/Core", "BObject", ACC_PUBLIC + ACC_STATIC); for (VarDeclNode decl : scope.values()) { <START> System.out.println("Declaring field: " + decl.getName()); <END> FieldVisitor fv = cw.visitField(ACC_PUBLIC, decl.getName(), "Lorg/twnc/runtime/BObject;", null, null); fv.visitEnd(); } mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, clazzNode.getSuperclass(), "<init>", "()V", false); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); if (clazzNode.hasMain()) { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null); mv.visitCode(); mv.visitTypeInsn(NEW, clazzNode.getName()); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, clazzNode.getName(), "<init>", "()V", false); mv.visitMethodInsn(INVOKEVIRTUAL, clazzNode.getName(), "_main", "()Lorg/twnc/runtime/BObject;", false); mv.visitInsn(POP); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); } super.visit(clazzNode); cw.visitEnd(); String path = outDir + clazzNode.getName() + ".class"; try (OutputStream out = new FileOutputStream(path)) { out.write(cw.toByteArray()); } catch (IOException e) { e.printStackTrace(); } }</code><technical_language>Debug print. Edit: I a of those, forgot this PR is a WIP, mind</technical_language>

Target:
public void visit(ClazzNode clazzNode) { scope = clazzNode.getScope(); cn = clazzNode; blockCount = 0; cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES + ClassWriter.COMPUTE_MAXS); cw.visit(52, ACC_PUBLIC + ACC_SUPER, clazzNode.getName(), null, clazzNode.getSuperclass(), null); cw.visitInnerClass("org/twnc/runtime/BObject", "org/twnc/runtime/Core", "BObject", ACC_PUBLIC + ACC_STATIC); for (VarDeclNode decl : scope.values()) { FieldVisitor fv = cw.visitField(ACC_PUBLIC, decl.getName(), "Lorg/twnc/runtime/BObject;", null, null); fv.visitEnd(); } mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, clazzNode.getSuperclass(), "<init>", "()V", false); visit(clazzNode.getDecls()); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); if (clazzNode.hasMain()) { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null); mv.visitCode(); mv.visitTypeInsn(NEW, clazzNode.getName()); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, clazzNode.getName(), "<init>", "()V", false); mv.visitMethodInsn(INVOKEVIRTUAL, clazzNode.getName(), "_main", "()Lorg/twnc/runtime/BObject;", false); mv.visitInsn(POP); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); } clazzNode.getMethods().forEach(x -> visit(x)); cw.visitEnd(); String path = outDir + clazzNode.getName() + ".class"; try (OutputStream out = new FileOutputStream(path)) { out.write(cw.toByteArray()); } catch (IOException e) { e.printStackTrace(); } }