Skip to content

Commit

Permalink
Instead of exception, only working when scope is found
Browse files Browse the repository at this point in the history
  • Loading branch information
leventeBajczi committed Nov 14, 2024
1 parent 99427b5 commit b36d87f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b36d87f

Please sign in to comment.