mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
rename syntax-mapping -> source-map
This commit is contained in:
parent
592b906604
commit
eaf1df26e9
11 changed files with 32 additions and 32 deletions
|
@ -225,6 +225,6 @@ impl RootDatabase {
|
|||
|
||||
self.query(hir::db::LowerModuleQuery).sweep(sweep);
|
||||
self.query(hir::db::LowerModuleSourceMapQuery).sweep(sweep);
|
||||
self.query(hir::db::BodySyntaxMappingQuery).sweep(sweep);
|
||||
self.query(hir::db::BodySourceMapQuery).sweep(sweep);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ pub(super) fn complete_dot(acc: &mut Completions, ctx: &CompletionContext) {
|
|||
_ => return,
|
||||
};
|
||||
let infer_result = function.infer(ctx.db);
|
||||
let syntax_mapping = function.body_syntax_mapping(ctx.db);
|
||||
let syntax_mapping = function.body_source_map(ctx.db);
|
||||
let expr = match syntax_mapping.node_expr(receiver) {
|
||||
Some(expr) => expr,
|
||||
None => return,
|
||||
|
|
|
@ -9,7 +9,7 @@ pub(super) fn complete_struct_literal(acc: &mut Completions, ctx: &CompletionCon
|
|||
_ => return,
|
||||
};
|
||||
let infer_result = function.infer(ctx.db);
|
||||
let syntax_mapping = function.body_syntax_mapping(ctx.db);
|
||||
let syntax_mapping = function.body_source_map(ctx.db);
|
||||
let expr = match syntax_mapping.node_expr(struct_lit.into()) {
|
||||
Some(expr) => expr,
|
||||
None => return,
|
||||
|
|
|
@ -54,7 +54,7 @@ pub(crate) fn reference_definition(
|
|||
if let Some(method_call) = name_ref.syntax().parent().and_then(ast::MethodCallExpr::cast) {
|
||||
tested_by!(goto_definition_works_for_methods);
|
||||
let infer_result = function.infer(db);
|
||||
let syntax_mapping = function.body_syntax_mapping(db);
|
||||
let syntax_mapping = function.body_source_map(db);
|
||||
let expr = ast::Expr::cast(method_call.syntax()).unwrap();
|
||||
if let Some(func) =
|
||||
syntax_mapping.node_expr(expr).and_then(|it| infer_result.method_resolution(it))
|
||||
|
@ -66,7 +66,7 @@ pub(crate) fn reference_definition(
|
|||
if let Some(field_expr) = name_ref.syntax().parent().and_then(ast::FieldExpr::cast) {
|
||||
tested_by!(goto_definition_works_for_fields);
|
||||
let infer_result = function.infer(db);
|
||||
let syntax_mapping = function.body_syntax_mapping(db);
|
||||
let syntax_mapping = function.body_source_map(db);
|
||||
let expr = ast::Expr::cast(field_expr.syntax()).unwrap();
|
||||
if let Some(field) =
|
||||
syntax_mapping.node_expr(expr).and_then(|it| infer_result.field_resolution(it))
|
||||
|
@ -80,7 +80,7 @@ pub(crate) fn reference_definition(
|
|||
tested_by!(goto_definition_works_for_named_fields);
|
||||
|
||||
let infer_result = function.infer(db);
|
||||
let syntax_mapping = function.body_syntax_mapping(db);
|
||||
let syntax_mapping = function.body_source_map(db);
|
||||
|
||||
let struct_lit = field_expr.syntax().ancestors().find_map(ast::StructLit::cast);
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ pub(crate) fn type_of(db: &RootDatabase, frange: FileRange) -> Option<String> {
|
|||
let parent_fn = node.ancestors().find_map(ast::FnDef::cast)?;
|
||||
let function = hir::source_binder::function_from_source(db, frange.file_id, parent_fn)?;
|
||||
let infer = function.infer(db);
|
||||
let syntax_mapping = function.body_syntax_mapping(db);
|
||||
let syntax_mapping = function.body_source_map(db);
|
||||
if let Some(expr) = ast::Expr::cast(node).and_then(|e| syntax_mapping.node_expr(e)) {
|
||||
Some(infer[expr].to_string())
|
||||
} else if let Some(pat) = ast::Pat::cast(node).and_then(|p| syntax_mapping.node_pat(p)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue