}
private JavaClass compileJast(SixModelObject jast, SixModelObject jastNodes, boolean split, ThreadContext tc) throws Exception {
SixModelObject jastClassObj = jastNodes.at_key_boxed(tc, "JAST::Class");
SixModelObject jastField = jastNodes.at_key_boxed(tc, "JAST::Field");
SixModelObject jastMethod = jastNodes.at_key_boxed(tc, "JAST::Method");
JastClass jastClass = new JastClass(jast, jastClassObj, tc);
JavaClass c = new JavaClass();
c.name = jastClass.className;
c.serialized = jastClass.serialized;
String className = jastClass.className.replace('.', '/');
String superName = jastClass.superName.replace('.', '/');
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
cw.visit(Opcodes.V1_7, Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER, className, null,
superName, null);
cw.visitSource(jastClass.filename, null);
SixModelObject iter = iter(jastClass.fields, tc);
while (istrue(iter, tc) != 0) {
JastField field = new JastField(iter.shift_boxed(tc), jastField, tc);
cw.visitField(
field.isStatic
? Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC
: Opcodes.ACC_PUBLIC,
field.name, field.type.getDescriptor(), null, null);
}
iter = iter(jastClass.methods, tc);
while (istrue(iter, tc) != 0) {
JastMethod method = new JastMethod(iter.shift_boxed(tc), jastMethod, tc);
compileMethod(c, method, cw, className, split, tc);
}
// Add empty constructor.
MethodVisitor constructor = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null);