From 1b91e25d17c6ccd4e4399ac206d6a9a630102589 Mon Sep 17 00:00:00 2001 From: Bruder John Date: Fri, 21 Jun 2024 18:09:32 +0200 Subject: [PATCH] fixed tests --- src/main/java/semantic/SemanticAnalyzer.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/semantic/SemanticAnalyzer.java b/src/main/java/semantic/SemanticAnalyzer.java index 8a16b47..c409c0d 100644 --- a/src/main/java/semantic/SemanticAnalyzer.java +++ b/src/main/java/semantic/SemanticAnalyzer.java @@ -181,8 +181,13 @@ public class SemanticAnalyzer implements SemanticVisitor { @Override public TypeCheckResult analyze(ReturnStatementNode toCheck) { - var result = toCheck.expression.accept(this); - return new TypeCheckResult(true, result.getType()); + if(toCheck.expression != null){ + var result = toCheck.expression.accept(this); + return new TypeCheckResult(true, result.getType()); + } else { + return new TypeCheckResult(false, null); + } + } @Override