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