mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
rename source_file -> parse
This commit is contained in:
parent
ac757e114e
commit
9457b1f0e6
19 changed files with 41 additions and 47 deletions
|
@ -43,7 +43,7 @@ pub fn module_from_declaration(
|
|||
|
||||
/// Locates the module by position in the source code.
|
||||
pub fn module_from_position(db: &impl HirDatabase, position: FilePosition) -> Option<Module> {
|
||||
let file = db.source_file(position.file_id);
|
||||
let file = db.parse(position.file_id);
|
||||
match find_node_at_offset::<ast::Module>(file.syntax(), position.offset) {
|
||||
Some(m) if !m.has_semi() => module_from_inline(db, position.file_id.into(), m),
|
||||
_ => module_from_file_id(db, position.file_id.into()),
|
||||
|
@ -95,7 +95,7 @@ fn module_from_source(db: &impl HirDatabase, source: SourceItemId) -> Option<Mod
|
|||
}
|
||||
|
||||
pub fn function_from_position(db: &impl HirDatabase, position: FilePosition) -> Option<Function> {
|
||||
let file = db.source_file(position.file_id);
|
||||
let file = db.parse(position.file_id);
|
||||
let fn_def = find_node_at_offset::<ast::FnDef>(file.syntax(), position.offset)?;
|
||||
function_from_source(db, position.file_id, fn_def)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue