Remove Statements#parent (#6392)

Discussed in
https://github.com/astral-sh/ruff/pull/6351#discussion_r1284997065.
This commit is contained in:
Charlie Marsh 2023-08-07 11:41:02 -04:00 committed by GitHub
parent e4a4660925
commit 9328606843
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 17 deletions

View file

@ -940,8 +940,10 @@ impl<'a> SemanticModel<'a> {
/// Given a [`Stmt`], return its parent, if any.
#[inline]
pub fn parent_statement(&self, statement: &'a Stmt) -> Option<&'a Stmt> {
self.statements.parent(statement)
pub fn parent_statement(&self, statement_id: StatementId) -> Option<&'a Stmt> {
self.statements
.parent_id(statement_id)
.map(|id| self.statements[id])
}
/// Set the [`Globals`] for the current [`Scope`].