Skip to content

Commit

Permalink
fix: this fix resolves an issue where methods incorrectly accessed in…
Browse files Browse the repository at this point in the history
…stance variables instead of global variables when both shared the same name. The erroneous behavior often led to interpreter crashes. The solution ensures proper variable scope resolution within methods
  • Loading branch information
jacopodl committed Sep 6, 2024
1 parent a9c3e4b commit 9f569d1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion argon/lang/compiler2/compiler2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ String *Compiler::MakeQName(String *name) {
SymbolT *Compiler::IdentifierLookupOrCreate(String *id, argon::lang::compiler2::SymbolType type) {
auto *dst = this->unit_->names;

auto *sym = this->unit_->symt->SymbolLookup(id, false);
auto *symt = this->unit_->symt;

if(symt->type == SymbolType::STRUCT || symt->type == SymbolType::TRAIT)
symt = symt->back;

auto *sym = symt->SymbolLookup(id, false);
if (sym == nullptr) {
auto freevar = this->unit_->IsFreeVar(id);

Expand Down

0 comments on commit 9f569d1

Please sign in to comment.