Added RefType codeGen logic
This commit is contained in:
parent
f273c74693
commit
1617e3ec62
@ -26,4 +26,8 @@ public class MethodDecl implements IClass {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void codeGen(ClassWriter cw) throws Exception {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import abstractSyntaxTree.Program;
|
||||
import jdk.jshell.spi.ExecutionControl;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -54,7 +55,18 @@ public class RefType extends AbstractType implements IClass {
|
||||
// and method declarations and calls their CodeGen methods
|
||||
@Override
|
||||
public void codeGen(ClassWriter cw) throws Exception {
|
||||
throw new ExecutionControl.NotImplementedException("CodeGen not implemented for RefType");
|
||||
|
||||
cw.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC, name, null,
|
||||
"java/lang/Object", null);
|
||||
|
||||
for (FieldDecl field : fieldDecls) {
|
||||
field.codeGen(cw);
|
||||
}
|
||||
|
||||
for (MethodDecl method : methodDecls) {
|
||||
method.codeGen(cw);
|
||||
}
|
||||
cw.visitEnd();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user