mirror of https://github.com/astral-sh/ruff
Comment
This commit is contained in:
parent
c4ba7e63a6
commit
61f11195fb
|
|
@ -241,6 +241,8 @@ impl<'db> SemanticModel<'db> {
|
||||||
let index = semantic_index(self.db, self.file);
|
let index = semantic_index(self.db, self.file);
|
||||||
match self.node_in_ast(node) {
|
match self.node_in_ast(node) {
|
||||||
ast::AnyNodeRef::Identifier(identifier) => index.try_expression_scope_id(identifier),
|
ast::AnyNodeRef::Identifier(identifier) => index.try_expression_scope_id(identifier),
|
||||||
|
|
||||||
|
// Nodes implementing `HasDefinition`
|
||||||
ast::AnyNodeRef::StmtFunctionDef(function) => Some(
|
ast::AnyNodeRef::StmtFunctionDef(function) => Some(
|
||||||
function
|
function
|
||||||
.definition(self)
|
.definition(self)
|
||||||
|
|
@ -271,6 +273,8 @@ impl<'db> SemanticModel<'db> {
|
||||||
ast::AnyNodeRef::TypeParamTypeVar(var) => {
|
ast::AnyNodeRef::TypeParamTypeVar(var) => {
|
||||||
Some(var.definition(self).scope(self.db).file_scope_id(self.db))
|
Some(var.definition(self).scope(self.db).file_scope_id(self.db))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fallback
|
||||||
node => match node.as_expr_ref() {
|
node => match node.as_expr_ref() {
|
||||||
// If we couldn't identify a specific
|
// If we couldn't identify a specific
|
||||||
// expression that we're in, then just
|
// expression that we're in, then just
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue