diff --git a/Source/abstractSyntaxTree/Class/MethodDecl.java b/Source/abstractSyntaxTree/Class/MethodDecl.java index 5787166..15f96ac 100644 --- a/Source/abstractSyntaxTree/Class/MethodDecl.java +++ b/Source/abstractSyntaxTree/Class/MethodDecl.java @@ -26,11 +26,6 @@ public class MethodDecl implements IClass { return null; } - @Override - public TypeCheckResult typeCheck() throws Exception { - return null; - } - @Override public void codeGen(ClassWriter cw) throws Exception { diff --git a/Source/abstractSyntaxTree/Class/RefType.java b/Source/abstractSyntaxTree/Class/RefType.java index a0c9fa5..d511e37 100644 --- a/Source/abstractSyntaxTree/Class/RefType.java +++ b/Source/abstractSyntaxTree/Class/RefType.java @@ -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; @@ -56,7 +57,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(); }