mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 21:35:58 +00:00
Add augmented assignment inference for -=
operator (#13981)
## Summary See: https://github.com/astral-sh/ruff/issues/12699
This commit is contained in:
parent
39cf46ecd6
commit
c6b82151dd
3 changed files with 179 additions and 65 deletions
|
@ -955,6 +955,12 @@ where
|
|||
};
|
||||
let symbol = self.add_symbol(id.clone());
|
||||
|
||||
if is_use {
|
||||
self.mark_symbol_used(symbol);
|
||||
let use_id = self.current_ast_ids().record_use(expr);
|
||||
self.current_use_def_map_mut().record_use(symbol, use_id);
|
||||
}
|
||||
|
||||
if is_definition {
|
||||
match self.current_assignment().copied() {
|
||||
Some(CurrentAssignment::Assign {
|
||||
|
@ -1018,12 +1024,6 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
if is_use {
|
||||
self.mark_symbol_used(symbol);
|
||||
let use_id = self.current_ast_ids().record_use(expr);
|
||||
self.current_use_def_map_mut().record_use(symbol, use_id);
|
||||
}
|
||||
|
||||
walk_expr(self, expr);
|
||||
}
|
||||
ast::Expr::Named(node) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue