Skip to content

Commit dadf430

Browse files
committed
Modify nonlocal to be declared multiple times
Related to RustPython#2183
1 parent 4a0ee1d commit dadf430

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

compiler/src/symboltable.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,14 +1025,7 @@ impl SymbolTableBuilder {
10251025
let symbol = table.symbols.get_mut(name).unwrap();
10261026
match role {
10271027
SymbolUsage::Nonlocal => {
1028-
if let SymbolScope::Unknown = symbol.scope {
1029-
symbol.scope = SymbolScope::Nonlocal;
1030-
} else {
1031-
return Err(SymbolTableError {
1032-
error: format!("Symbol {} scope cannot be set to nonlocal, since its scope was already determined otherwise.", name),
1033-
location,
1034-
});
1035-
}
1028+
symbol.scope = SymbolScope::Nonlocal;
10361029
}
10371030
SymbolUsage::Imported => {
10381031
symbol.is_assigned = true;

0 commit comments

Comments
 (0)