From ff3807a83ffd9c669f5f6b28b073ed12ad31ee5c Mon Sep 17 00:00:00 2001 From: XZQshiyu <2313392804@qq.com> Date: Mon, 14 Oct 2024 11:12:09 +0000 Subject: [PATCH] lab2:fix a bug int cminusf_builder.cpp( get_terminator -> is_terminated ) --- src/cminusfc/cminusf_builder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cminusfc/cminusf_builder.cpp b/src/cminusfc/cminusf_builder.cpp index cb34ac5..0360444 100644 --- a/src/cminusfc/cminusf_builder.cpp +++ b/src/cminusfc/cminusf_builder.cpp @@ -76,7 +76,7 @@ Value* CminusfBuilder::visit(ASTFunDeclaration &node) { // TODO: You need to deal with params and store them in the scope. } node.compound_stmt->accept(*this); - if (builder->get_insert_block()->get_terminator() == nullptr) + if (not builder->get_insert_block()->is_terminated()) { if (context.func->get_return_type()->is_void_type()) builder->create_void_ret(); @@ -106,7 +106,7 @@ Value* CminusfBuilder::visit(ASTCompoundStmt &node) { for (auto &stmt : node.statement_list) { stmt->accept(*this); - if (builder->get_insert_block()->get_terminator() == nullptr) + if (builder->get_insert_block()->is_terminated()) break; } return nullptr; -- GitLab