Add constructor for empty class
This commit is contained in:
parent
da68aacaa0
commit
a1378f1cfb
@ -3,6 +3,7 @@ package bytecode;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import parser.ClassDeclarationNode;
|
||||
import parser.ProgramNode;
|
||||
@ -14,7 +15,15 @@ public class ByteCodeGenerator {
|
||||
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
||||
cw.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC, classDeclarationNode.identifier, null,
|
||||
"java/lang/Object", null);
|
||||
|
||||
MethodVisitor constructor =
|
||||
cw.visitMethod(Opcodes.ACC_PUBLIC,
|
||||
"<init>",
|
||||
"()V",
|
||||
null,
|
||||
null);
|
||||
cw.visitEnd();
|
||||
|
||||
printIntoClassFile(cw.toByteArray(), classDeclarationNode.identifier);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user