Add a binding kind for comprehension targets (#9967)
## Summary I was surprised to learn that we treat `x` in `[_ for x in y]` as an "assignment" binding kind, rather than a dedicated comprehension variable.
This commit is contained in:
@@ -432,6 +432,12 @@ 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:
|
||||
|
||||
Reference in New Issue
Block a user