mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-08 05:35:22 +00:00
Simplify scan_expression
This commit is contained in:
parent
a7f1904564
commit
64736d0541
1 changed files with 4 additions and 10 deletions
|
@ -885,16 +885,10 @@ impl SymbolTableBuilder {
|
|||
self.scan_expression(value, ExpressionContext::Load)?;
|
||||
}
|
||||
Dict { keys, values } => {
|
||||
let (packed, unpacked): (Vec<_>, Vec<_>) = keys
|
||||
.iter()
|
||||
.zip(values.iter())
|
||||
.partition(|(key, _)| key.is_some());
|
||||
for (key, value) in packed {
|
||||
self.scan_expression(key.as_ref().unwrap(), context)?;
|
||||
self.scan_expression(value, context)?;
|
||||
}
|
||||
for (_, value) in unpacked {
|
||||
// dict unpacking marker
|
||||
for (key, value) in keys.iter().zip(values.iter()) {
|
||||
if let Some(key) = key {
|
||||
self.scan_expression(key, context)?;
|
||||
}
|
||||
self.scan_expression(value, context)?;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue