Allow storing defs in bodies

This commit is contained in:
Aleksey Kladov 2019-12-19 17:30:28 +01:00
parent b2731ab78a
commit 5bd8de3f5e
2 changed files with 3 additions and 1 deletions

View File

@ -17,7 +17,7 @@ use crate::{
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>>;

View 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)