|
1 | 1 | use core::iter;
|
2 | 2 | use std::cmp::Ordering;
|
3 |
| - |
4 | 3 | use itertools::Either;
|
5 | 4 | use rhai_rowan::{TextRange, TextSize};
|
6 |
| - |
7 |
| -use crate::{ |
8 |
| - error::{Error, ErrorKind}, |
9 |
| - scope::ScopeParent, |
10 |
| -}; |
| 5 | +use crate::scope::ScopeParent; |
11 | 6 |
|
12 | 7 | use super::*;
|
13 | 8 |
|
@@ -270,31 +265,6 @@ impl Hir {
|
270 | 265 | None
|
271 | 266 | }
|
272 | 267 |
|
273 |
| - #[must_use] |
274 |
| - pub fn errors(&self) -> Vec<Error> { |
275 |
| - let mut errors = Vec::new(); |
276 |
| - |
277 |
| - for (symbol, _) in self.symbols() { |
278 |
| - self.collect_errors_from_symbol(symbol, &mut errors); |
279 |
| - } |
280 |
| - |
281 |
| - errors |
282 |
| - } |
283 |
| - |
284 |
| - #[must_use] |
285 |
| - pub fn errors_for_source(&self, source: Source) -> Vec<Error> { |
286 |
| - let mut errors = Vec::new(); |
287 |
| - |
288 |
| - for (symbol, _) in self |
289 |
| - .symbols() |
290 |
| - .filter(|(_, symbol_data)| symbol_data.source.source == Some(source)) |
291 |
| - { |
292 |
| - self.collect_errors_from_symbol(symbol, &mut errors); |
293 |
| - } |
294 |
| - |
295 |
| - errors |
296 |
| - } |
297 |
| - |
298 | 268 | /// All the missing modules that appear in imports.
|
299 | 269 | #[must_use]
|
300 | 270 | pub fn missing_modules(&self) -> impl ExactSizeIterator<Item = Url> {
|
@@ -351,25 +321,7 @@ impl Hir {
|
351 | 321 | None
|
352 | 322 | }
|
353 | 323 |
|
354 |
| - fn collect_errors_from_symbol(&self, symbol: Symbol, errors: &mut Vec<Error>) { |
355 |
| - if let Some(symbol_data) = self.symbol(symbol) { |
356 |
| - if let SymbolKind::Reference(r) = &symbol_data.kind { |
357 |
| - if !r.field_access && r.target.is_none() && r.name != "this" { |
358 |
| - errors.push(Error { |
359 |
| - text_range: symbol_data.selection_or_text_range(), |
360 |
| - kind: ErrorKind::UnresolvedReference { |
361 |
| - reference_name: r.name.clone(), |
362 |
| - reference_range: symbol_data.selection_or_text_range(), |
363 |
| - reference_symbol: symbol, |
364 |
| - similar_name: self.find_similar_name(symbol, &r.name), |
365 |
| - }, |
366 |
| - }); |
367 |
| - } |
368 |
| - } |
369 |
| - } |
370 |
| - } |
371 |
| - |
372 |
| - fn find_similar_name(&self, symbol: Symbol, name: &str) -> Option<String> { |
| 324 | + pub(super) fn find_similar_name(&self, symbol: Symbol, name: &str) -> Option<String> { |
373 | 325 | const MIN_DISTANCE: f64 = 0.5;
|
374 | 326 |
|
375 | 327 | self.visible_symbols_from_symbol(symbol)
|
|
0 commit comments