diff options
author | Aleksey Kladov <[email protected]> | 2019-12-08 11:44:14 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-12-08 11:44:14 +0000 |
commit | b37c6a746b6c7cf85dc1ec6e40ac41455b8f2ec0 (patch) | |
tree | c816b6c6fe6e950fc0835259a2a5026e04267d51 /crates/ra_cli/src/analysis_stats.rs | |
parent | b77d7c24aa929e53a2bc2a0ffa319de9bf1ab1fa (diff) |
Remove ty from code_model
Diffstat (limited to 'crates/ra_cli/src/analysis_stats.rs')
-rw-r--r-- | crates/ra_cli/src/analysis_stats.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/crates/ra_cli/src/analysis_stats.rs b/crates/ra_cli/src/analysis_stats.rs index 9b1802a5f..ac65415a5 100644 --- a/crates/ra_cli/src/analysis_stats.rs +++ b/crates/ra_cli/src/analysis_stats.rs | |||
@@ -2,8 +2,13 @@ | |||
2 | 2 | ||
3 | use std::{collections::HashSet, fmt::Write, path::Path, time::Instant}; | 3 | use std::{collections::HashSet, fmt::Write, path::Path, time::Instant}; |
4 | 4 | ||
5 | use hir::{ | ||
6 | db::{DefDatabase, HirDatabase}, | ||
7 | AssocItem, Crate, HasSource, HirDisplay, ModuleDef, | ||
8 | }; | ||
9 | use hir_def::FunctionId; | ||
10 | use hir_ty::{Ty, TypeWalk}; | ||
5 | use ra_db::SourceDatabaseExt; | 11 | use ra_db::SourceDatabaseExt; |
6 | use ra_hir::{AssocItem, Crate, HasSource, HirDisplay, ModuleDef, Ty, TypeWalk}; | ||
7 | use ra_syntax::AstNode; | 12 | use ra_syntax::AstNode; |
8 | 13 | ||
9 | use crate::{progress_report::ProgressReport, Result, Verbosity}; | 14 | use crate::{progress_report::ProgressReport, Result, Verbosity}; |
@@ -101,8 +106,9 @@ pub fn run( | |||
101 | continue; | 106 | continue; |
102 | } | 107 | } |
103 | } | 108 | } |
104 | let body = f.body(db); | 109 | let f_id = FunctionId::from(f); |
105 | let inference_result = f.infer(db); | 110 | let body = db.body(f_id.into()); |
111 | let inference_result = db.infer(f_id.into()); | ||
106 | for (expr_id, _) in body.exprs.iter() { | 112 | for (expr_id, _) in body.exprs.iter() { |
107 | let ty = &inference_result[expr_id]; | 113 | let ty = &inference_result[expr_id]; |
108 | num_exprs += 1; | 114 | num_exprs += 1; |
@@ -122,7 +128,8 @@ pub fn run( | |||
122 | if let Some(mismatch) = inference_result.type_mismatch_for_expr(expr_id) { | 128 | if let Some(mismatch) = inference_result.type_mismatch_for_expr(expr_id) { |
123 | num_type_mismatches += 1; | 129 | num_type_mismatches += 1; |
124 | if verbosity.is_verbose() { | 130 | if verbosity.is_verbose() { |
125 | let src = f.body_source_map(db).expr_syntax(expr_id); | 131 | let (_, sm) = db.body_with_source_map(f_id.into()); |
132 | let src = sm.expr_syntax(expr_id); | ||
126 | if let Some(src) = src { | 133 | if let Some(src) = src { |
127 | // FIXME: it might be nice to have a function (on Analysis?) that goes from Source<T> -> (LineCol, LineCol) directly | 134 | // FIXME: it might be nice to have a function (on Analysis?) that goes from Source<T> -> (LineCol, LineCol) directly |
128 | let original_file = src.file_id.original_file(db); | 135 | let original_file = src.file_id.original_file(db); |