Skip to content

Commit

Permalink
fix(Compiler): resolve variable capture issue within a closure
Browse files Browse the repository at this point in the history
  • Loading branch information
jacopodl committed Oct 2, 2023
1 parent cc5cc41 commit 2ad901d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions argon/lang/translation_unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ bool TranslationUnit::IsFreeVar(String *id) const {
SymbolT *sym;

for (TranslationUnit *tu = this->prev; tu != nullptr; tu = tu->prev) {
if (tu->symt->type == SymbolType::STRUCT || tu->symt->type == SymbolType::TRAIT)
continue;

if ((sym = SymbolLookup(tu->symt, id)) != nullptr) {
// WARNING: sym->nested must be greater than 0,
// otherwise this is a global variable.
Expand Down

0 comments on commit 2ad901d

Please sign in to comment.