mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-31 07:38:00 +00:00
Refactor the ExprDict
node (#11267)
Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
parent
de270154a1
commit
6774f27f4b
52 changed files with 2425 additions and 2240 deletions
|
@ -376,16 +376,12 @@ pub fn walk_expr<V: Transformer + ?Sized>(visitor: &V, expr: &mut Expr) {
|
|||
visitor.visit_expr(body);
|
||||
visitor.visit_expr(orelse);
|
||||
}
|
||||
Expr::Dict(ast::ExprDict {
|
||||
keys,
|
||||
values,
|
||||
range: _,
|
||||
}) => {
|
||||
for expr in keys.iter_mut().flatten() {
|
||||
visitor.visit_expr(expr);
|
||||
}
|
||||
for expr in values {
|
||||
visitor.visit_expr(expr);
|
||||
Expr::Dict(ast::ExprDict { items, range: _ }) => {
|
||||
for ast::DictItem { key, value } in items {
|
||||
if let Some(key) = key {
|
||||
visitor.visit_expr(key);
|
||||
}
|
||||
visitor.visit_expr(value);
|
||||
}
|
||||
}
|
||||
Expr::Set(ast::ExprSet { elts, range: _ }) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue