diff --git a/build.gradle.kts b/build.gradle.kts index d097203cde..642c9fde76 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -29,7 +29,7 @@ buildscript { allprojects { group = "hu.bme.mit.theta" - version = "6.8.4" + version = "6.8.5" apply(from = rootDir.resolve("gradle/shared-with-buildSrc/mirrors.gradle.kts")) } diff --git a/subprojects/frontends/c-frontend/src/main/java/hu/bme/mit/theta/frontend/transformation/grammar/function/FunctionVisitor.java b/subprojects/frontends/c-frontend/src/main/java/hu/bme/mit/theta/frontend/transformation/grammar/function/FunctionVisitor.java index 93ed299903..a8325f792f 100644 --- a/subprojects/frontends/c-frontend/src/main/java/hu/bme/mit/theta/frontend/transformation/grammar/function/FunctionVisitor.java +++ b/subprojects/frontends/c-frontend/src/main/java/hu/bme/mit/theta/frontend/transformation/grammar/function/FunctionVisitor.java @@ -525,19 +525,15 @@ public CStatement visitBodyDeclaration(CParser.BodyDeclarationContext ctx) { parseContext); recordMetadata(ctx, cAssignment); compound.getcStatementList().add(cAssignment); - if (currentStatementContext.isEmpty()) { - throw new RuntimeException( - "Scope for variable " + declaration.getName() + " not found."); - } - final var scope = currentStatementContext.peek().get2(); - if (scope.isEmpty() || scope.get().getPostStatements() instanceof CCompound) { - throw new RuntimeException( - "Scope for variable " + declaration.getName() + " not found."); - } - if (scope.get().getPostStatements() == null) { - scope.get().setPostStatements(new CCompound(parseContext)); + if (!currentStatementContext.isEmpty()) { + final var scope = currentStatementContext.peek().get2(); + if (scope.isPresent() && scope.get().getPostStatements() instanceof CCompound) { + if (scope.get().getPostStatements() == null) { + scope.get().setPostStatements(new CCompound(parseContext)); + } + ((CCompound) scope.get().getPostStatements()).getcStatementList().add(free); + } } - ((CCompound) scope.get().getPostStatements()).getcStatementList().add(free); } if (declaration.getInitExpr() != null) { if (declaration.getType() instanceof Struct) {