]> git.lizzy.rs Git - rust.git/commitdiff
Allow storing defs in bodies
authorAleksey Kladov <aleksey.kladov@gmail.com>
Thu, 19 Dec 2019 16:30:28 +0000 (17:30 +0100)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Thu, 19 Dec 2019 17:09:50 +0000 (18:09 +0100)
crates/ra_hir_def/src/body.rs
crates/ra_hir_def/src/body/lower.rs

index d4cab05614096cab4fa3d456ace3c1573628dc7e..332c509e17063d3b520ad91d2c0bf944b477f54a 100644 (file)
@@ -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<PatId>,
     /// The `ExprId` of the actual body expression.
     pub body_expr: ExprId,
+    pub defs: Vec<ModuleDefId>,
 }
 
 pub type ExprPtr = Either<AstPtr<ast::Expr>, AstPtr<ast::RecordField>>;
index 61193b4d8040827e49fc742de0a2f60fb505cb35..86960186f198407c3ad6588222bfd877ae8ed81e 100644 (file)
@@ -41,6 +41,7 @@ pub(super) fn lower(
             pats: Arena::default(),
             params: Vec::new(),
             body_expr: ExprId::dummy(),
+            defs: Vec::new(),
         },
     }
     .collect(params, body)