Skip to content

Commit

Permalink
remove module_to_file query
Browse files Browse the repository at this point in the history
  • Loading branch information
carljm committed May 9, 2024
1 parent a0900b8 commit 0151628
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
5 changes: 0 additions & 5 deletions crates/red_knot/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,6 @@ pub struct ModuleData {
// Queries
//////////////////////////////////////////////////////

#[tracing::instrument(level = "debug", skip(db))]
pub fn module_to_file(db: &dyn SemanticDb, module: Module) -> QueryResult<FileId> {
Ok(module.path(db)?.file())
}

/// Resolves a module name to a module id
/// TODO: This would not work with Salsa because `ModuleName` isn't an ingredient and, therefore, cannot be used as part of a query.
/// For this to work with salsa, it would be necessary to intern all `ModuleName`s.
Expand Down
4 changes: 2 additions & 2 deletions crates/red_knot/src/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::ast_ids::{NodeKey, TypedNodeKey};
use crate::cache::KeyValueCache;
use crate::db::{QueryResult, SemanticDb, SemanticJar};
use crate::files::FileId;
use crate::module::{module_to_file, resolve_module, ModuleName};
use crate::module::{resolve_module, ModuleName};
use crate::parse::parse;
use crate::Name;

Expand All @@ -41,7 +41,7 @@ pub fn resolve_global_symbol(
let Some(typing_module) = resolve_module(db, module)? else {
return Ok(None);
};
let typing_file = module_to_file(db, typing_module)?;
let typing_file = typing_module.path(db)?.file();
let typing_table = symbol_table(db, typing_file)?;
let Some(typing_override) = typing_table.root_symbol_id_by_name(name) else {
return Ok(None);
Expand Down

0 comments on commit 0151628

Please sign in to comment.