diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-09-02 20:20:24 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-09-02 20:20:24 +0100 |
commit | 7faec1c30046769d4ae490e15cf5405bcfbdeef8 (patch) | |
tree | 6d268b721027a5350928a6c5a0ec227b5fde8ebc /crates/ra_hir/src/expr/scope.rs | |
parent | a8397deab914240aca8f015fb3736689919c0a5b (diff) | |
parent | e94587e3153b52684fd3f6b82c8e7efc09ff5c8d (diff) |
Merge #1752
1752: Always wrap blocks into block expressions r=flodiebold a=matklad
This way, things like function bodies are expressions, and we don't have to single them out
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/expr/scope.rs')
-rw-r--r-- | crates/ra_hir/src/expr/scope.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/ra_hir/src/expr/scope.rs b/crates/ra_hir/src/expr/scope.rs index 79e1857f9..b6d7f3fc1 100644 --- a/crates/ra_hir/src/expr/scope.rs +++ b/crates/ra_hir/src/expr/scope.rs | |||
@@ -172,7 +172,7 @@ fn compute_expr_scopes(expr: ExprId, body: &Body, scopes: &mut ExprScopes, scope | |||
172 | #[cfg(test)] | 172 | #[cfg(test)] |
173 | mod tests { | 173 | mod tests { |
174 | use ra_db::SourceDatabase; | 174 | use ra_db::SourceDatabase; |
175 | use ra_syntax::{algo::find_node_at_offset, ast, AstNode, SyntaxNodePtr}; | 175 | use ra_syntax::{algo::find_node_at_offset, ast, AstNode}; |
176 | use test_utils::{assert_eq_text, extract_offset}; | 176 | use test_utils::{assert_eq_text, extract_offset}; |
177 | 177 | ||
178 | use crate::{mock::MockDatabase, source_binder::SourceAnalyzer}; | 178 | use crate::{mock::MockDatabase, source_binder::SourceAnalyzer}; |
@@ -194,8 +194,7 @@ mod tests { | |||
194 | let analyzer = SourceAnalyzer::new(&db, file_id, marker.syntax(), None); | 194 | let analyzer = SourceAnalyzer::new(&db, file_id, marker.syntax(), None); |
195 | 195 | ||
196 | let scopes = analyzer.scopes(); | 196 | let scopes = analyzer.scopes(); |
197 | let expr_id = | 197 | let expr_id = analyzer.body_source_map().node_expr(&marker.into()).unwrap(); |
198 | analyzer.body_source_map().syntax_expr(SyntaxNodePtr::new(marker.syntax())).unwrap(); | ||
199 | let scope = scopes.scope_for(expr_id); | 198 | let scope = scopes.scope_for(expr_id); |
200 | 199 | ||
201 | let actual = scopes | 200 | let actual = scopes |