This commit is contained in:
Micha Reiser 2025-12-11 18:59:07 +01:00
parent c4ba7e63a6
commit 61f11195fb
No known key found for this signature in database
1 changed files with 4 additions and 0 deletions

View File

@ -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