mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-17 17:10:34 +00:00
Remove Stmt::TryStar
(#6566)
## Summary Instead, we set an `is_star` flag on `Stmt::Try`. This is similar to the pattern we've migrated towards for `Stmt::For` (removing `Stmt::AsyncFor`) and friends. While these are significant differences for an interpreter, we tend to handle these cases identically or nearly identically. ## Test Plan `cargo test`
This commit is contained in:
parent
09c8b17661
commit
96d310fbab
33 changed files with 70 additions and 489 deletions
|
@ -64,27 +64,6 @@ pub fn suite<'a>(stmt: &'a Stmt, parent: &'a Stmt) -> Option<&'a Suite> {
|
|||
.find(|body| body.contains(stmt))
|
||||
}
|
||||
}
|
||||
Stmt::TryStar(ast::StmtTryStar {
|
||||
body,
|
||||
handlers,
|
||||
orelse,
|
||||
finalbody,
|
||||
..
|
||||
}) => {
|
||||
if body.contains(stmt) {
|
||||
Some(body)
|
||||
} else if orelse.contains(stmt) {
|
||||
Some(orelse)
|
||||
} else if finalbody.contains(stmt) {
|
||||
Some(finalbody)
|
||||
} else {
|
||||
handlers
|
||||
.iter()
|
||||
.filter_map(ExceptHandler::as_except_handler)
|
||||
.map(|handler| &handler.body)
|
||||
.find(|body| body.contains(stmt))
|
||||
}
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue