[red-knot] Watch search paths (#12407)

This commit is contained in:
Micha Reiser 2024-07-24 09:38:50 +02:00 committed by GitHub
parent 8659f2f4ea
commit eac965ecaf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 409 additions and 37 deletions

View file

@ -103,9 +103,13 @@ impl<'db> SemanticIndexBuilder<'db> {
#[allow(unsafe_code)]
// SAFETY: `node` is guaranteed to be a child of `self.module`
let scope_id = ScopeId::new(self.db, self.file, file_scope_id, unsafe {
node.to_kind(self.module.clone())
});
let scope_id = ScopeId::new(
self.db,
self.file,
file_scope_id,
unsafe { node.to_kind(self.module.clone()) },
countme::Count::default(),
);
self.scope_ids_by_scope.push(scope_id);
self.scopes_by_node.insert(node.node_key(), file_scope_id);
@ -180,6 +184,7 @@ impl<'db> SemanticIndexBuilder<'db> {
unsafe {
definition_node.into_owned(self.module.clone())
},
countme::Count::default(),
);
self.definitions_by_node
@ -201,6 +206,7 @@ impl<'db> SemanticIndexBuilder<'db> {
unsafe {
AstNodeRef::new(self.module.clone(), expression_node)
},
countme::Count::default(),
);
self.expressions_by_node
.insert(expression_node.into(), expression);

View file

@ -24,6 +24,9 @@ pub struct Definition<'db> {
#[no_eq]
#[return_ref]
pub(crate) node: DefinitionKind,
#[no_eq]
count: countme::Count<Definition<'static>>,
}
impl<'db> Definition<'db> {

View file

@ -22,6 +22,9 @@ pub(crate) struct Expression<'db> {
#[no_eq]
#[return_ref]
pub(crate) node: AstNodeRef<ast::Expr>,
#[no_eq]
count: countme::Count<Expression<'static>>,
}
impl<'db> Expression<'db> {

View file

@ -100,6 +100,9 @@ pub struct ScopeId<'db> {
#[no_eq]
#[return_ref]
pub node: NodeWithScopeKind,
#[no_eq]
count: countme::Count<ScopeId<'static>>,
}
impl<'db> ScopeId<'db> {