diff --git a/build/ast.cpp.o b/build/ast.cpp.o index d3dd39a173b13aac2e7a0d2034589a2fffa4ac21..efd69ed54700650278eca84ef38038eece747878 100644 Binary files a/build/ast.cpp.o and b/build/ast.cpp.o differ diff --git a/build/compiler b/build/compiler index bc5b53f15924a79d3927e5ecab6e0ffa23448462..1b5903fdb3b08bbe83312cb1dfebfa37075d74ba 100644 Binary files a/build/compiler and b/build/compiler differ diff --git a/src/ast.cpp b/src/ast.cpp index 46e81ce85c33ce919ff45ce10eb9c0811620820c..7d82ee39eed25037b9e5953ac7f5f1708e0bac7d 100644 --- a/src/ast.cpp +++ b/src/ast.cpp @@ -52,23 +52,25 @@ void BlockAST::Dump() const void BlockItemAST::Dump() const { - if (type_ == 1) - decl->Dump(); - if (type_ == 2) - stmt->Dump(); + if (return_ == 1) + { + if (type_ == 1) + decl->Dump(); + if (type_ == 2) + stmt->Dump(); + } } // Stmt ::= "return" Exp ";"; void StmtAST::Dump() const { + if (type_ == 1) { - if (return_ == 1) - { - exp->Dump(); - std::cout << " ret %" << cnt << std::endl; - return_++; - } + + exp->Dump(); + std::cout << " ret %" << cnt << std::endl; + return_++; } else if (type_ == 2) {