aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-12-19 16:30:28 +0000
committerAleksey Kladov <[email protected]>2019-12-19 17:09:50 +0000
commit5bd8de3f5e11732d67d0cc9bacda7d3a1b7cf13a (patch)
tree0381b42e5e3b4daab49c734728b11f22361c2067
parentb2731ab78acc7a2d38e02cd477f4a5132c1ac98b (diff)
Allow storing defs in bodies
-rw-r--r--crates/ra_hir_def/src/body.rs3
-rw-r--r--crates/ra_hir_def/src/body/lower.rs1
2 files changed, 3 insertions, 1 deletions
diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs
index d4cab0561..332c509e1 100644
--- a/crates/ra_hir_def/src/body.rs
+++ b/crates/ra_hir_def/src/body.rs
@@ -17,7 +17,7 @@ use crate::{
17 nameres::{BuiltinShadowMode, CrateDefMap}, 17 nameres::{BuiltinShadowMode, CrateDefMap},
18 path::{ModPath, Path}, 18 path::{ModPath, Path},
19 src::HasSource, 19 src::HasSource,
20 DefWithBodyId, HasModule, Lookup, ModuleId, 20 DefWithBodyId, HasModule, Lookup, ModuleDefId, ModuleId,
21}; 21};
22 22
23struct Expander { 23struct Expander {
@@ -119,6 +119,7 @@ pub struct Body {
119 pub params: Vec<PatId>, 119 pub params: Vec<PatId>,
120 /// The `ExprId` of the actual body expression. 120 /// The `ExprId` of the actual body expression.
121 pub body_expr: ExprId, 121 pub body_expr: ExprId,
122 pub defs: Vec<ModuleDefId>,
122} 123}
123 124
124pub type ExprPtr = Either<AstPtr<ast::Expr>, AstPtr<ast::RecordField>>; 125pub type ExprPtr = Either<AstPtr<ast::Expr>, AstPtr<ast::RecordField>>;
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index 61193b4d8..86960186f 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -41,6 +41,7 @@ pub(super) fn lower(
41 pats: Arena::default(), 41 pats: Arena::default(),
42 params: Vec::new(), 42 params: Vec::new(),
43 body_expr: ExprId::dummy(), 43 body_expr: ExprId::dummy(),
44 defs: Vec::new(),
44 }, 45 },
45 } 46 }
46 .collect(params, body) 47 .collect(params, body)