|
4 | 4 | // |
5 | 5 | // Copyright (c) 2018, Olof Kraigher olof.kraigher@gmail.com |
6 | 6 |
|
7 | | -use crate::analysis::{AnyEnt, AnyEntKind, Design, DesignRoot, EntRef}; |
8 | | -use crate::ast::search::FindAllEnt; |
9 | | -use crate::ast::{DesignFile, Designator}; |
| 7 | +use crate::analysis::{AnyEnt, DesignRoot, EntRef}; |
| 8 | +use crate::ast::DesignFile; |
10 | 9 | use crate::config::Config; |
11 | 10 | use crate::data::*; |
12 | 11 | use crate::syntax::VHDLParser; |
@@ -241,49 +240,11 @@ impl Project { |
241 | 240 | self.root.item_at_cursor(source, cursor) |
242 | 241 | } |
243 | 242 |
|
244 | | - fn get_library(&self, source: &Source) -> Option<Symbol> { |
245 | | - let file = self.files.get(source.file_name())?; |
246 | | - file.library_names.iter().next().cloned() |
247 | | - } |
248 | | - |
249 | | - pub fn find_implementation<'a>( |
250 | | - &'a self, |
251 | | - source: &Source, |
252 | | - cursor: Position, |
253 | | - ) -> Option<Vec<EntRef<'a>>> { |
254 | | - let ent = self.find_declaration(source, cursor)?; |
255 | | - |
256 | | - let ident = if let Designator::Identifier(ident) = ent.designator() { |
257 | | - ident |
| 243 | + pub fn find_implementation<'a>(&'a self, source: &Source, cursor: Position) -> Vec<EntRef<'a>> { |
| 244 | + if let Some(ent) = self.find_declaration(source, cursor) { |
| 245 | + self.root.find_implementation(ent) |
258 | 246 | } else { |
259 | | - return None; |
260 | | - }; |
261 | | - |
262 | | - match ent.kind() { |
263 | | - // Find entity with same name as component in the library |
264 | | - AnyEntKind::Component(_) => { |
265 | | - let decl_pos = ent.decl_pos()?; |
266 | | - let library_name = self.get_library(decl_pos.source())?; |
267 | | - let design = self.root.get_design_entity(&library_name, ident)?; |
268 | | - Some(vec![design.into()]) |
269 | | - } |
270 | | - // Find all components with same name as entity in the library |
271 | | - AnyEntKind::Design(Design::Entity(..)) => { |
272 | | - let decl_pos = ent.decl_pos()?; |
273 | | - let library_name = self.get_library(decl_pos.source())?; |
274 | | - |
275 | | - let mut searcher = FindAllEnt::new(&self.root, |ent| { |
276 | | - matches!(ent.kind(), AnyEntKind::Component(_)) |
277 | | - && matches!( |
278 | | - ent.designator(), |
279 | | - Designator::Identifier(comp_ident) if comp_ident == ident |
280 | | - ) |
281 | | - }); |
282 | | - |
283 | | - let _ = self.root.search_library(&library_name, &mut searcher); |
284 | | - Some(searcher.result) |
285 | | - } |
286 | | - _ => None, |
| 247 | + Vec::default() |
287 | 248 | } |
288 | 249 | } |
289 | 250 |
|
|
0 commit comments