From ad06d279dfd0c66581e68bdc596537f8f1ef001a Mon Sep 17 00:00:00 2001 From: Patrick Gingras <775.pg.12@gmail.com> Date: Sat, 2 Sep 2023 12:56:56 -0400 Subject: [PATCH] fix implicit return --- joe/codegen.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/joe/codegen.py b/joe/codegen.py index cc8a15a..a5d779e 100644 --- a/joe/codegen.py +++ b/joe/codegen.py @@ -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":