From: Aleksey Kladov Date: Thu, 19 Dec 2019 16:30:28 +0000 (+0100) Subject: Allow storing defs in bodies X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=5bd8de3f5e11732d67d0cc9bacda7d3a1b7cf13a;p=rust.git Allow storing defs in bodies --- diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs index d4cab056140..332c509e170 100644 --- a/crates/ra_hir_def/src/body.rs +++ b/crates/ra_hir_def/src/body.rs @@ -17,7 +17,7 @@ nameres::{BuiltinShadowMode, CrateDefMap}, path::{ModPath, Path}, src::HasSource, - DefWithBodyId, HasModule, Lookup, ModuleId, + DefWithBodyId, HasModule, Lookup, ModuleDefId, ModuleId, }; struct Expander { @@ -119,6 +119,7 @@ pub struct Body { pub params: Vec, /// The `ExprId` of the actual body expression. pub body_expr: ExprId, + pub defs: Vec, } pub type ExprPtr = Either, AstPtr>; diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 61193b4d804..86960186f19 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( pats: Arena::default(), params: Vec::new(), body_expr: ExprId::dummy(), + defs: Vec::new(), }, } .collect(params, body)