mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-15 08:00:19 +00:00
Fix miscellaneous issues in await-outside-async detection
(#14218)
## Summary Closes https://github.com/astral-sh/ruff/issues/14167.
This commit is contained in:
parent
b19f388249
commit
93fdf7ed36
7 changed files with 177 additions and 31 deletions
|
@ -170,13 +170,21 @@ bitflags! {
|
|||
pub enum ScopeKind<'a> {
|
||||
Class(&'a ast::StmtClassDef),
|
||||
Function(&'a ast::StmtFunctionDef),
|
||||
Generator,
|
||||
Generator(GeneratorKind),
|
||||
Module,
|
||||
/// A Python 3.12+ [annotation scope](https://docs.python.org/3/reference/executionmodel.html#annotation-scopes)
|
||||
Type,
|
||||
Lambda(&'a ast::ExprLambda),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum GeneratorKind {
|
||||
Generator,
|
||||
ListComprehension,
|
||||
DictComprehension,
|
||||
SetComprehension,
|
||||
}
|
||||
|
||||
/// Id uniquely identifying a scope in a program.
|
||||
///
|
||||
/// Using a `u32` is sufficient because Ruff only supports parsing documents with a size of max `u32::max`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue