@@ -14,13 +14,13 @@ use crate::syntax::VHDLParser;
1414use crate :: { data:: * , EntHierarchy , EntityId } ;
1515use fnv:: { FnvHashMap , FnvHashSet } ;
1616use std:: collections:: hash_map:: Entry ;
17- use std:: path:: { Path , PathBuf } ;
17+ use std:: path:: Path ;
1818
1919pub struct Project {
2020 parser : VHDLParser ,
2121 config : Config ,
2222 root : DesignRoot ,
23- files : FnvHashMap < PathBuf , SourceFile > ,
23+ files : FnvHashMap < FilePath , SourceFile > ,
2424 empty_libraries : FnvHashSet < Symbol > ,
2525 lint : Option < UnusedDeclarationsLinter > ,
2626}
@@ -90,8 +90,8 @@ impl Project {
9090 & mut self ,
9191 config : & Config ,
9292 messages : & mut dyn MessageHandler ,
93- ) -> FnvHashMap < PathBuf , FnvHashSet < Symbol > > {
94- let mut files: FnvHashMap < PathBuf , FnvHashSet < Symbol > > = FnvHashMap :: default ( ) ;
93+ ) -> FnvHashMap < FilePath , FnvHashSet < Symbol > > {
94+ let mut files: FnvHashMap < FilePath , FnvHashSet < Symbol > > = FnvHashMap :: default ( ) ;
9595 self . empty_libraries . clear ( ) ;
9696
9797 for library in config. iter_libraries ( ) {
@@ -103,7 +103,7 @@ impl Project {
103103 for file_name in library. file_names ( messages) {
104104 empty_library = false ;
105105
106- match files. entry ( file_name . clone ( ) ) {
106+ match files. entry ( FilePath :: new ( & file_name ) ) {
107107 Entry :: Occupied ( mut entry) => {
108108 entry. get_mut ( ) . insert ( library_name. clone ( ) ) ;
109109 }
@@ -124,7 +124,7 @@ impl Project {
124124
125125 fn parse_and_add_files (
126126 & mut self ,
127- files_to_parse : FnvHashMap < PathBuf , FnvHashSet < Symbol > > ,
127+ files_to_parse : FnvHashMap < FilePath , FnvHashSet < Symbol > > ,
128128 messages : & mut dyn MessageHandler ,
129129 ) {
130130 use rayon:: prelude:: * ;
@@ -151,7 +151,7 @@ impl Project {
151151 } ;
152152
153153 self . files . insert (
154- source. file_name ( ) . to_owned ( ) ,
154+ FilePath :: new ( source. file_name ( ) ) ,
155155 SourceFile {
156156 source,
157157 library_names,
@@ -163,7 +163,7 @@ impl Project {
163163 }
164164
165165 pub fn library_mapping_of ( & self , source : & Source ) -> Vec < Symbol > {
166- let file = if let Some ( file) = self . files . get ( source. file_name ( ) ) {
166+ let file = if let Some ( file) = self . files . get ( source. file_path ( ) ) {
167167 file
168168 } else {
169169 return Vec :: new ( ) ;
@@ -174,12 +174,14 @@ impl Project {
174174 }
175175
176176 pub fn get_source ( & self , file_name : & Path ) -> Option < Source > {
177- self . files . get ( file_name) . map ( |file| file. source . clone ( ) )
177+ self . files
178+ . get ( & FilePath :: new ( file_name) )
179+ . map ( |file| file. source . clone ( ) )
178180 }
179181
180182 pub fn update_source ( & mut self , source : & Source ) {
181183 let mut source_file = {
182- if let Some ( mut source_file) = self . files . remove ( source. file_name ( ) ) {
184+ if let Some ( mut source_file) = self . files . remove ( source. file_path ( ) ) {
183185 // File is already part of the project
184186 for library_name in source_file. library_names . iter ( ) {
185187 self . root . remove_source ( library_name. clone ( ) , source) ;
@@ -208,7 +210,7 @@ impl Project {
208210 . parser
209211 . parse_design_source ( source, & mut source_file. parser_diagnostics ) ;
210212 self . files
211- . insert ( source. file_name ( ) . to_owned ( ) , source_file) ;
213+ . insert ( source. file_path ( ) . to_owned ( ) , source_file) ;
212214 }
213215
214216 pub fn analyse ( & mut self ) -> Vec < Diagnostic > {
0 commit comments