diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-09-19 19:18:41 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-09-19 19:18:41 +0100 |
commit | cd9b222ba0555424d73d549eac43d9aaf1765d7d (patch) | |
tree | 88eea12084b65ba7b0f808cc2c626c7b57c7ac53 /crates/ra_hir/src/nameres | |
parent | 44bab3621d74f1aec922300a3b3f4476907ba2ac (diff) | |
parent | 2867c40925e8f7b440ff50a421a2d3726b9ff334 (diff) |
Merge #1853
1853: Introduce FromSource trait r=matklad a=viorina
The idea is to provide an ability to get HIR from AST in a more general way than it's possible using `source_binder`.
It also could help with #1622 fixing.
Co-authored-by: Ekaterina Babshukova <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/nameres')
-rw-r--r-- | crates/ra_hir/src/nameres/tests/incremental.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/ra_hir/src/nameres/tests/incremental.rs b/crates/ra_hir/src/nameres/tests/incremental.rs index bc721f6e0..c41862a0b 100644 --- a/crates/ra_hir/src/nameres/tests/incremental.rs +++ b/crates/ra_hir/src/nameres/tests/incremental.rs | |||
@@ -114,7 +114,11 @@ fn typing_inside_a_macro_should_not_invalidate_def_map() { | |||
114 | ); | 114 | ); |
115 | { | 115 | { |
116 | let events = db.log_executed(|| { | 116 | let events = db.log_executed(|| { |
117 | let module = crate::source_binder::module_from_file_id(&db, pos.file_id).unwrap(); | 117 | let src = crate::Source { |
118 | file_id: pos.file_id.into(), | ||
119 | ast: crate::ModuleSource::new(&db, Some(pos.file_id), None), | ||
120 | }; | ||
121 | let module = crate::Module::from_definition(&db, src).unwrap(); | ||
118 | let decls = module.declarations(&db); | 122 | let decls = module.declarations(&db); |
119 | assert_eq!(decls.len(), 18); | 123 | assert_eq!(decls.len(), 18); |
120 | }); | 124 | }); |
@@ -124,7 +128,11 @@ fn typing_inside_a_macro_should_not_invalidate_def_map() { | |||
124 | 128 | ||
125 | { | 129 | { |
126 | let events = db.log_executed(|| { | 130 | let events = db.log_executed(|| { |
127 | let module = crate::source_binder::module_from_file_id(&db, pos.file_id).unwrap(); | 131 | let src = crate::Source { |
132 | file_id: pos.file_id.into(), | ||
133 | ast: crate::ModuleSource::new(&db, Some(pos.file_id), None), | ||
134 | }; | ||
135 | let module = crate::Module::from_definition(&db, src).unwrap(); | ||
128 | let decls = module.declarations(&db); | 136 | let decls = module.declarations(&db); |
129 | assert_eq!(decls.len(), 18); | 137 | assert_eq!(decls.len(), 18); |
130 | }); | 138 | }); |