diff --git a/src/symboltable.rs b/src/symboltable.rs index ab931ac..c07b5ae 100644 --- a/src/symboltable.rs +++ b/src/symboltable.rs @@ -251,9 +251,12 @@ impl SymbolTableAnalyzer { if found_in_outer_scope { // Symbol is in some outer scope. symbol.is_free = true; - } else { + } else if self.tables.is_empty() { // Don't make assumptions when we don't know. symbol.scope = SymbolScope::Unknown; + } else { + // If there are scopes above we can assume global. + symbol.scope = SymbolScope::Global; } } }