diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-11-14 07:36:47 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-11-14 07:36:47 +0000 |
commit | 8af85263f7cd249356382aa61b98094594165364 (patch) | |
tree | bed1d8bfef7cd3c42917d30fae2d8002dd00c38c /crates/ra_hir/src/expr | |
parent | 38a3c76d154231ded00ca1decfd55bdaebe67bae (diff) | |
parent | da2ca01ebaaaaa47aa09c5848c53b145a68af8fa (diff) |
Merge #2235
2235: Handle macro-generated expressions slightly less wrong r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/expr')
-rw-r--r-- | crates/ra_hir/src/expr/scope.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_hir/src/expr/scope.rs b/crates/ra_hir/src/expr/scope.rs index fe5e836f2..afba66069 100644 --- a/crates/ra_hir/src/expr/scope.rs +++ b/crates/ra_hir/src/expr/scope.rs | |||
@@ -166,6 +166,7 @@ fn compute_expr_scopes(expr: ExprId, body: &Body, scopes: &mut ExprScopes, scope | |||
166 | 166 | ||
167 | #[cfg(test)] | 167 | #[cfg(test)] |
168 | mod tests { | 168 | mod tests { |
169 | use hir_expand::Source; | ||
169 | use ra_db::{fixture::WithFixture, SourceDatabase}; | 170 | use ra_db::{fixture::WithFixture, SourceDatabase}; |
170 | use ra_syntax::{algo::find_node_at_offset, ast, AstNode}; | 171 | use ra_syntax::{algo::find_node_at_offset, ast, AstNode}; |
171 | use test_utils::{assert_eq_text, extract_offset}; | 172 | use test_utils::{assert_eq_text, extract_offset}; |
@@ -189,7 +190,10 @@ mod tests { | |||
189 | let analyzer = SourceAnalyzer::new(&db, file_id, marker.syntax(), None); | 190 | let analyzer = SourceAnalyzer::new(&db, file_id, marker.syntax(), None); |
190 | 191 | ||
191 | let scopes = analyzer.scopes(); | 192 | let scopes = analyzer.scopes(); |
192 | let expr_id = analyzer.body_source_map().node_expr(&marker.into()).unwrap(); | 193 | let expr_id = analyzer |
194 | .body_source_map() | ||
195 | .node_expr(Source { file_id: file_id.into(), ast: &marker.into() }) | ||
196 | .unwrap(); | ||
193 | let scope = scopes.scope_for(expr_id); | 197 | let scope = scopes.scope_for(expr_id); |
194 | 198 | ||
195 | let actual = scopes | 199 | let actual = scopes |