add performances and fix unary

This commit is contained in:
Boolean-true 2024-06-23 18:35:57 +02:00
parent e2937b13e5
commit 64c3ed6db3
2 changed files with 11 additions and 2 deletions

View File

@ -6,6 +6,13 @@
- Code-Generierung: Simon Wittmann
- Testen: Jonathan Fleischmann
# Erbrachte Leistungen
- Laurenz Schleicher: Grammatik entwickeln, Records, Statements als Liste zurückgeben, Generator, Syntactic Sugar auflösen
- Julian Kraus: Grammatik entwickeln, Generator, Syntactic Sugar auflösen
- Ahmad Juha: Typcheck
- Simon Wittmann: Codegen und Tool für ASM
- Jonathan Fleischmann: Tests
# Fehlende Tests für Features (positive Tests):
- Main-Methode
- Klammern von Expressions

View File

@ -35,14 +35,16 @@ public class TypedUnary implements TypedExpression {
if (right.typeCheck(typedProgram) != Type.BOOL) {
throw new RuntimeException("Not operator must be applied to boolean");
}
return Type.BOOL;
type = Type.BOOL;
return type;
}
if (op == UnaryOperator.SUB) {
if (right.typeCheck(typedProgram) != Type.INT) {
throw new RuntimeException("Minus operator must be applied to int");
}
return Type.BOOL;
type = Type.INT;
return type;
}
throw new RuntimeException("Unknown unary operator");
}