mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-22 04:25:11 +00:00
Include decorators in Function
and Class
definition ranges (#4467)
This commit is contained in:
parent
9308e939f4
commit
daadd24bde
11 changed files with 198 additions and 136 deletions
|
@ -953,12 +953,7 @@ impl From<(ast::Stmt, &Locator<'_>)> for Stmt {
|
|||
};
|
||||
|
||||
Stmt {
|
||||
range: TextRange::new(
|
||||
decorator_list
|
||||
.first()
|
||||
.map_or(range.start(), ast::Ranged::start),
|
||||
body.end(),
|
||||
),
|
||||
range: TextRange::new(range.start(), body.end()),
|
||||
node: StmtKind::FunctionDef {
|
||||
name: name.into(),
|
||||
args: Box::new((*args, locator).into()),
|
||||
|
@ -999,12 +994,7 @@ impl From<(ast::Stmt, &Locator<'_>)> for Stmt {
|
|||
};
|
||||
|
||||
Stmt {
|
||||
range: TextRange::new(
|
||||
decorator_list
|
||||
.first()
|
||||
.map_or(range.start(), |expr| expr.range().start()),
|
||||
body.end(),
|
||||
),
|
||||
range: TextRange::new(range.start(), body.end()),
|
||||
node: StmtKind::AsyncFunctionDef {
|
||||
name: name.into(),
|
||||
args: Box::new((*args, locator).into()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue