aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-11-28 13:00:03 +0000
committerAleksey Kladov <[email protected]>2019-11-28 13:02:38 +0000
commite823c578c9f6886fe9db9767cb81e75a6c56bf15 (patch)
tree903f9f2ded4a197c2736b4459cda89c6639dd277 /crates/ra_hir_def/src
parent16030528b53d38e24c1e5733aa4cc46058d0bbd1 (diff)
Use InFile for AstId
Diffstat (limited to 'crates/ra_hir_def/src')
-rw-r--r--crates/ra_hir_def/src/attr.rs2
-rw-r--r--crates/ra_hir_def/src/lib.rs10
-rw-r--r--crates/ra_hir_def/src/nameres.rs6
-rw-r--r--crates/ra_hir_def/src/nameres/tests/mod_resolution.rs4
4 files changed, 11 insertions, 11 deletions
diff --git a/crates/ra_hir_def/src/attr.rs b/crates/ra_hir_def/src/attr.rs
index 83783ac7a..346019f88 100644
--- a/crates/ra_hir_def/src/attr.rs
+++ b/crates/ra_hir_def/src/attr.rs
@@ -157,7 +157,7 @@ where
157 N: ast::AttrsOwner, 157 N: ast::AttrsOwner,
158 D: DefDatabase, 158 D: DefDatabase,
159{ 159{
160 let src = InFile::new(src.file_id(), src.to_node(db)); 160 let src = InFile::new(src.file_id, src.to_node(db));
161 Attrs::from_attrs_owner(db, src.as_ref().map(|it| it as &dyn AttrsOwner)) 161 Attrs::from_attrs_owner(db, src.as_ref().map(|it| it as &dyn AttrsOwner))
162} 162}
163 163
diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs
index 9d89692bf..6daf7d3a3 100644
--- a/crates/ra_hir_def/src/lib.rs
+++ b/crates/ra_hir_def/src/lib.rs
@@ -108,7 +108,7 @@ pub trait AstItemDef<N: AstNode>: salsa::InternKey + Clone {
108 fn source(self, db: &(impl AstDatabase + InternDatabase)) -> InFile<N> { 108 fn source(self, db: &(impl AstDatabase + InternDatabase)) -> InFile<N> {
109 let loc = self.lookup_intern(db); 109 let loc = self.lookup_intern(db);
110 let value = loc.ast_id.to_node(db); 110 let value = loc.ast_id.to_node(db);
111 InFile { file_id: loc.ast_id.file_id(), value } 111 InFile { file_id: loc.ast_id.file_id, value }
112 } 112 }
113 fn module(self, db: &impl InternDatabase) -> ModuleId { 113 fn module(self, db: &impl InternDatabase) -> ModuleId {
114 let loc = self.lookup_intern(db); 114 let loc = self.lookup_intern(db);
@@ -525,7 +525,7 @@ impl HasSource for FunctionLoc {
525 525
526 fn source(&self, db: &impl db::DefDatabase) -> InFile<ast::FnDef> { 526 fn source(&self, db: &impl db::DefDatabase) -> InFile<ast::FnDef> {
527 let node = self.ast_id.to_node(db); 527 let node = self.ast_id.to_node(db);
528 InFile::new(self.ast_id.file_id(), node) 528 InFile::new(self.ast_id.file_id, node)
529 } 529 }
530} 530}
531 531
@@ -534,7 +534,7 @@ impl HasSource for TypeAliasLoc {
534 534
535 fn source(&self, db: &impl db::DefDatabase) -> InFile<ast::TypeAliasDef> { 535 fn source(&self, db: &impl db::DefDatabase) -> InFile<ast::TypeAliasDef> {
536 let node = self.ast_id.to_node(db); 536 let node = self.ast_id.to_node(db);
537 InFile::new(self.ast_id.file_id(), node) 537 InFile::new(self.ast_id.file_id, node)
538 } 538 }
539} 539}
540 540
@@ -543,7 +543,7 @@ impl HasSource for ConstLoc {
543 543
544 fn source(&self, db: &impl db::DefDatabase) -> InFile<ast::ConstDef> { 544 fn source(&self, db: &impl db::DefDatabase) -> InFile<ast::ConstDef> {
545 let node = self.ast_id.to_node(db); 545 let node = self.ast_id.to_node(db);
546 InFile::new(self.ast_id.file_id(), node) 546 InFile::new(self.ast_id.file_id, node)
547 } 547 }
548} 548}
549 549
@@ -552,7 +552,7 @@ impl HasSource for StaticLoc {
552 552
553 fn source(&self, db: &impl db::DefDatabase) -> InFile<ast::StaticDef> { 553 fn source(&self, db: &impl db::DefDatabase) -> InFile<ast::StaticDef> {
554 let node = self.ast_id.to_node(db); 554 let node = self.ast_id.to_node(db);
555 InFile::new(self.ast_id.file_id(), node) 555 InFile::new(self.ast_id.file_id, node)
556 } 556 }
557} 557}
558 558
diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs
index 1b369ea11..df42ea84a 100644
--- a/crates/ra_hir_def/src/nameres.rs
+++ b/crates/ra_hir_def/src/nameres.rs
@@ -267,7 +267,7 @@ impl ModuleData {
267 return InFile::new(file_id.into(), Either::A(sf)); 267 return InFile::new(file_id.into(), Either::A(sf));
268 } 268 }
269 let decl = self.declaration.unwrap(); 269 let decl = self.declaration.unwrap();
270 InFile::new(decl.file_id(), Either::B(decl.to_node(db))) 270 InFile::new(decl.file_id, Either::B(decl.to_node(db)))
271 } 271 }
272 272
273 /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`. 273 /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`.
@@ -275,7 +275,7 @@ impl ModuleData {
275 pub fn declaration_source(&self, db: &impl DefDatabase) -> Option<InFile<ast::Module>> { 275 pub fn declaration_source(&self, db: &impl DefDatabase) -> Option<InFile<ast::Module>> {
276 let decl = self.declaration?; 276 let decl = self.declaration?;
277 let value = decl.to_node(db); 277 let value = decl.to_node(db);
278 Some(InFile { file_id: decl.file_id(), value }) 278 Some(InFile { file_id: decl.file_id, value })
279 } 279 }
280} 280}
281 281
@@ -309,7 +309,7 @@ mod diagnostics {
309 } 309 }
310 let decl = declaration.to_node(db); 310 let decl = declaration.to_node(db);
311 sink.push(UnresolvedModule { 311 sink.push(UnresolvedModule {
312 file: declaration.file_id(), 312 file: declaration.file_id,
313 decl: AstPtr::new(&decl), 313 decl: AstPtr::new(&decl),
314 candidate: candidate.clone(), 314 candidate: candidate.clone(),
315 }) 315 })
diff --git a/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs b/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs
index e11530062..e800cc68e 100644
--- a/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs
+++ b/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs
@@ -668,7 +668,7 @@ fn unresolved_module_diagnostics() {
668 module: LocalModuleId( 668 module: LocalModuleId(
669 0, 669 0,
670 ), 670 ),
671 declaration: AstId { 671 declaration: InFile {
672 file_id: HirFileId( 672 file_id: HirFileId(
673 FileId( 673 FileId(
674 FileId( 674 FileId(
@@ -676,7 +676,7 @@ fn unresolved_module_diagnostics() {
676 ), 676 ),
677 ), 677 ),
678 ), 678 ),
679 file_ast_id: FileAstId { 679 value: FileAstId {
680 raw: ErasedFileAstId( 680 raw: ErasedFileAstId(
681 1, 681 1,
682 ), 682 ),