fixed thistar
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
Bruder John 2024-07-03 18:33:30 +02:00
parent 7ccff3208c
commit b7863d0684
3 changed files with 8 additions and 21 deletions

View File

@ -5,7 +5,6 @@ import bytecode.visitor.MethodVisitor;
import visitor.Visitable;
public class MainMethodNode extends MethodNode implements Visitable {
public BlockNode block;
public MainMethodNode(BlockNode block) {
this.block = block;

View File

@ -344,11 +344,13 @@ public class SemanticAnalyzer implements SemanticVisitor {
}
} else {
if (toCheck.target.thisTar != null) {
if (toCheck.target.thisTar) {
var type = getTypeFromMethod(toCheck, new ReferenceType(currentClass.identifier));
if (type != null) {
return new TypeCheckResult(true, type);
}
}
} else {
var result = toCheck.target.accept(this);
if (result.getType() instanceof ReferenceType reference) {
@ -394,9 +396,9 @@ public class SemanticAnalyzer implements SemanticVisitor {
if (context.containsClass(toCheck.identifier)) {
return new TypeCheckResult(true, new ReferenceType(toCheck.identifier));
} else {
throw new RuntimeException("Cannot find class " + toCheck.identifier);
}
return null;
}
@Override

View File

@ -1,21 +1,7 @@
public class CorrectTest {
int a;
boolean b;
char c;
public void controlStructures(int adf, boolean bool) {
if (a > (10 + 8)) {
} else {
public class Run {
public static void main(String[] args) {
// Test t = new Test();
// System.out.println(t.test());
}
while (a > adf) {
a--;
}
for (int i = 0; i < 5; i++) {
}
}
}