diff options
author | Florian Diebold <[email protected]> | 2019-01-05 21:37:59 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-01-05 23:29:36 +0000 |
commit | 8e3e5ab2c81f238ea4e731f55eac79b74d9d84c3 (patch) | |
tree | e0388878b4d94ae71fbf82d3e3163c49c8e69c16 /crates/ra_hir/src/query_definitions.rs | |
parent | 136aba1cf32646278c4034541ee415f656f8bb5e (diff) |
Make FnScopes use hir::Expr
This was a bit complicated. I've added a wrapper type for now that does the
LocalSyntaxPtr <-> ExprId translation; we might want to get rid of that or give
it a nicer interface.
Diffstat (limited to 'crates/ra_hir/src/query_definitions.rs')
-rw-r--r-- | crates/ra_hir/src/query_definitions.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/crates/ra_hir/src/query_definitions.rs b/crates/ra_hir/src/query_definitions.rs index a5d99beda..d9ee9d37f 100644 --- a/crates/ra_hir/src/query_definitions.rs +++ b/crates/ra_hir/src/query_definitions.rs | |||
@@ -11,7 +11,7 @@ use ra_syntax::{ | |||
11 | use ra_db::{SourceRootId, Cancelable,}; | 11 | use ra_db::{SourceRootId, Cancelable,}; |
12 | 12 | ||
13 | use crate::{ | 13 | use crate::{ |
14 | SourceFileItems, SourceItemId, DefKind, Function, DefId, Name, AsName, HirFileId, | 14 | SourceFileItems, SourceItemId, DefKind, DefId, Name, AsName, HirFileId, |
15 | MacroCallLoc, | 15 | MacroCallLoc, |
16 | db::HirDatabase, | 16 | db::HirDatabase, |
17 | function::FnScopes, | 17 | function::FnScopes, |
@@ -23,11 +23,10 @@ use crate::{ | |||
23 | adt::{StructData, EnumData}, | 23 | adt::{StructData, EnumData}, |
24 | }; | 24 | }; |
25 | 25 | ||
26 | pub(super) fn fn_scopes(db: &impl HirDatabase, def_id: DefId) -> Arc<FnScopes> { | 26 | pub(super) fn fn_scopes(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Arc<FnScopes>> { |
27 | let function = Function::new(def_id); | 27 | let body = db.body_hir(def_id)?; |
28 | let syntax = function.syntax(db); | 28 | let res = FnScopes::new(body); |
29 | let res = FnScopes::new(syntax.borrowed()); | 29 | Ok(Arc::new(res)) |
30 | Arc::new(res) | ||
31 | } | 30 | } |
32 | 31 | ||
33 | pub(super) fn struct_data(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Arc<StructData>> { | 32 | pub(super) fn struct_data(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Arc<StructData>> { |