mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-18 18:45:23 +00:00
Merge pull request #1332 from RustPython/load_global_loading_local
load_global shouldn't load outermost locals.
This commit is contained in:
commit
4ae902f788
1 changed files with 4 additions and 1 deletions
|
@ -251,8 +251,11 @@ impl SymbolTableAnalyzer {
|
||||||
if found_in_outer_scope {
|
if found_in_outer_scope {
|
||||||
// Symbol is in some outer scope.
|
// Symbol is in some outer scope.
|
||||||
symbol.is_free = true;
|
symbol.is_free = true;
|
||||||
|
} else if self.tables.is_empty() {
|
||||||
|
// Don't make assumptions when we don't know.
|
||||||
|
symbol.scope = SymbolScope::Unknown;
|
||||||
} else {
|
} else {
|
||||||
// Well, it must be a global then :)
|
// If there are scopes above we can assume global.
|
||||||
symbol.scope = SymbolScope::Global;
|
symbol.scope = SymbolScope::Global;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue