Skip to content

Commit

Permalink
fix: Fixed defer not working at top level
Browse files Browse the repository at this point in the history
  • Loading branch information
alinalihassan committed May 22, 2022
1 parent c5fe7b6 commit a5da7b2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/liblesma/Backend/Codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,15 @@ int Codegen::JIT() {
}

void Codegen::Run() {
deferStack.push({});
visit(Parser_->getAST());

auto instrs = deferStack.top();
deferStack.pop();

for (auto inst: instrs)
visit(inst);

// Return 0 for top-level function
Builder->CreateRet(ConstantInt::getSigned(Builder->getInt64Ty(), 0));
}
Expand Down

0 comments on commit a5da7b2

Please sign in to comment.