Endabgabe #20

Merged
i22035 merged 137 commits from Endabgabe into main 2024-07-05 11:59:47 +00:00
4 changed files with 16 additions and 3 deletions
Showing only changes of commit f7338a06b3 - Show all commits

View File

@ -50,7 +50,7 @@ public class MethodCodeGen implements bytecode.visitor.MethodVisitor {
@Override
public void visit(ConstructorNode constructorNode) {
methodVisitor =
classWriter.visitMethod(mapper.mapAccessTypeToOpcode(constructorNode.accessType),
classWriter.visitMethod(mapper.mapAccessTypeToOpcode(constructorNode.accesModifier),
"<init>",
mapper.generateMethodDescriptor(new BaseType(TypeEnum.VOID), constructorNode.parameters),
null,

View File

@ -246,6 +246,9 @@ public class SemanticAnalyzer implements SemanticVisitor {
if (currentFields.get(toCheck.identifier) != null) {
var type = currentFields.get(toCheck.identifier);
toCheck.setTypeNode(type);
MemberAccessNode memberAccessNode = new MemberAccessNode(false);
memberAccessNode.identifiers.add(currentClass.identifier);
toCheck.memberAccess = memberAccessNode;
return new TypeCheckResult(true, type);
} else if (currentScope.getLocalVar(toCheck.identifier) != null) {
var type = currentScope.getLocalVar(toCheck.identifier);

View File

@ -0,0 +1,10 @@
// @expected: TypeMismatchException
public class AllFeaturesClassExample {
int x;
public boolean test(boolean x){
return this.x;
}
}

View File

@ -2,8 +2,8 @@
public class AllFeaturesClassExample {
int x;
public boolean test(boolean x){
return x;
public void test(){
x = 1;
}
}