Skip to content

Commit

Permalink
fix implicit return
Browse files Browse the repository at this point in the history
  • Loading branch information
p7g committed Sep 2, 2023
1 parent d195131 commit ad06d27
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions joe/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ def _push_scope(self):

def visit_method_decl(self, method_decl: ast.MethodDecl) -> None:
super().visit_method_decl(method_decl)
last_block = self.llvm_function.basic_blocks[-1]
if not last_block.is_terminated:
last_block = self.ir_builder.block
if last_block and not last_block.is_terminated:
self.ir_builder.position_at_end(last_block)
self._comment("implicit return")
if method_decl.return_type.name.name != "void":
Expand Down

0 comments on commit ad06d27

Please sign in to comment.