Merge remote-tracking branch 'origin/master'

# Conflicts:
#	Source/abstractSyntaxTree/Class/MethodDecl.java
This commit is contained in:
Krauß, Josefine 2024-05-08 15:15:25 +02:00
commit b8a8a094f4
2 changed files with 13 additions and 6 deletions

View File

@ -26,11 +26,6 @@ public class MethodDecl implements IClass {
return null; return null;
} }
@Override
public TypeCheckResult typeCheck() throws Exception {
return null;
}
@Override @Override
public void codeGen(ClassWriter cw) throws Exception { public void codeGen(ClassWriter cw) throws Exception {

View File

@ -9,6 +9,7 @@ import abstractSyntaxTree.Program;
import jdk.jshell.spi.ExecutionControl; import jdk.jshell.spi.ExecutionControl;
import org.objectweb.asm.ClassWriter; import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -56,7 +57,18 @@ public class RefType extends AbstractType implements IClass {
// and method declarations and calls their CodeGen methods // and method declarations and calls their CodeGen methods
@Override @Override
public void codeGen(ClassWriter cw) throws Exception { 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();
} }