mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:04 +00:00
Remove BindingKind::ComprehensionVar
(#12347)
## Summary This doesn't seem to be used anywhere. Maybe it mattered when we didn't handle generator scopes properly?
This commit is contained in:
parent
d0c5925672
commit
30cef67b45
5 changed files with 0 additions and 21 deletions
|
@ -2009,16 +2009,6 @@ impl<'a> Checker<'a> {
|
|||
return;
|
||||
}
|
||||
|
||||
// If the expression is part of a comprehension target, then it's a comprehension variable
|
||||
// assignment, as in:
|
||||
// ```python
|
||||
// [x for x in range(10)]
|
||||
// ```
|
||||
if self.semantic.in_comprehension_assignment() {
|
||||
self.add_binding(id, expr.range(), BindingKind::ComprehensionVar, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
// Match the left-hand side of an annotated assignment without a value,
|
||||
// like `x` in `x: int`. N.B. In stub files, these should be viewed
|
||||
// as assignments on par with statements such as `x: int = 5`.
|
||||
|
|
|
@ -264,7 +264,6 @@ impl Renamer {
|
|||
| BindingKind::Assignment
|
||||
| BindingKind::BoundException
|
||||
| BindingKind::LoopVar
|
||||
| BindingKind::ComprehensionVar
|
||||
| BindingKind::WithItemVar
|
||||
| BindingKind::Global(_)
|
||||
| BindingKind::Nonlocal(_, _)
|
||||
|
|
|
@ -47,7 +47,6 @@ pub(super) fn test_expression(expr: &Expr, semantic: &SemanticModel) -> Resoluti
|
|||
| BindingKind::Assignment
|
||||
| BindingKind::NamedExprAssignment
|
||||
| BindingKind::LoopVar
|
||||
| BindingKind::ComprehensionVar
|
||||
| BindingKind::Global(_)
|
||||
| BindingKind::Nonlocal(_, _) => Resolution::RelevantLocal,
|
||||
BindingKind::Import(import)
|
||||
|
|
|
@ -56,7 +56,6 @@ pub(crate) fn non_ascii_name(binding: &Binding, locator: &Locator) -> Option<Dia
|
|||
BindingKind::Assignment => Kind::Assignment,
|
||||
BindingKind::TypeParam => Kind::TypeParam,
|
||||
BindingKind::LoopVar => Kind::LoopVar,
|
||||
BindingKind::ComprehensionVar => Kind::ComprenhensionVar,
|
||||
BindingKind::WithItemVar => Kind::WithItemVar,
|
||||
BindingKind::Global(_) => Kind::Global,
|
||||
BindingKind::Nonlocal(_, _) => Kind::Nonlocal,
|
||||
|
@ -94,7 +93,6 @@ enum Kind {
|
|||
Assignment,
|
||||
TypeParam,
|
||||
LoopVar,
|
||||
ComprenhensionVar,
|
||||
WithItemVar,
|
||||
Global,
|
||||
Nonlocal,
|
||||
|
@ -112,7 +110,6 @@ impl fmt::Display for Kind {
|
|||
Kind::Assignment => f.write_str("Variable"),
|
||||
Kind::TypeParam => f.write_str("Type parameter"),
|
||||
Kind::LoopVar => f.write_str("Variable"),
|
||||
Kind::ComprenhensionVar => f.write_str("Variable"),
|
||||
Kind::WithItemVar => f.write_str("Variable"),
|
||||
Kind::Global => f.write_str("Global"),
|
||||
Kind::Nonlocal => f.write_str("Nonlocal"),
|
||||
|
|
|
@ -467,12 +467,6 @@ pub enum BindingKind<'a> {
|
|||
/// ```
|
||||
LoopVar,
|
||||
|
||||
/// A binding for a comprehension variable, like `x` in:
|
||||
/// ```python
|
||||
/// [x for x in range(10)]
|
||||
/// ```
|
||||
ComprehensionVar,
|
||||
|
||||
/// A binding for a with statement variable, like `x` in:
|
||||
/// ```python
|
||||
/// with open('foo.py') as x:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue