Commit ff3807a8 authored by lyz's avatar lyz

lab2:fix a bug int cminusf_builder.cpp( get_terminator -> is_terminated )

parent da409e47
...@@ -76,7 +76,7 @@ Value* CminusfBuilder::visit(ASTFunDeclaration &node) { ...@@ -76,7 +76,7 @@ Value* CminusfBuilder::visit(ASTFunDeclaration &node) {
// TODO: You need to deal with params and store them in the scope. // TODO: You need to deal with params and store them in the scope.
} }
node.compound_stmt->accept(*this); 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()) if (context.func->get_return_type()->is_void_type())
builder->create_void_ret(); builder->create_void_ret();
...@@ -106,7 +106,7 @@ Value* CminusfBuilder::visit(ASTCompoundStmt &node) { ...@@ -106,7 +106,7 @@ Value* CminusfBuilder::visit(ASTCompoundStmt &node) {
for (auto &stmt : node.statement_list) { for (auto &stmt : node.statement_list) {
stmt->accept(*this); stmt->accept(*this);
if (builder->get_insert_block()->get_terminator() == nullptr) if (builder->get_insert_block()->is_terminated())
break; break;
} }
return nullptr; return nullptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment