mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-14 00:25:17 +00:00
Be somewhat less conservative about declaring things global.
This commit is contained in:
parent
9c17d982ff
commit
f3ecba02b1
1 changed files with 4 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue