Use GenericParam in ScopeDef

This commit is contained in:
Aleksey Kladov 2019-11-21 14:22:30 +03:00
parent 1312c57d34
commit ca1af86e7b
2 changed files with 10 additions and 4 deletions

View file

@ -1070,7 +1070,7 @@ pub struct ImplBlock {
pub enum ScopeDef {
ModuleDef(ModuleDef),
MacroDef(MacroDef),
GenericParam(u32),
GenericParam(GenericParam),
ImplSelfType(ImplBlock),
AdtSelfType(Adt),
Local(Local),

View file

@ -19,7 +19,7 @@ use crate::{
code_model::Crate,
db::HirDatabase,
expr::{ExprScopes, PatId, ScopeId},
DefWithBody, GenericDef, Local, MacroDef, PerNs, ScopeDef,
DefWithBody, GenericDef, GenericParam, Local, MacroDef, PerNs, ScopeDef,
};
#[derive(Debug, Clone, Default)]
@ -447,9 +447,15 @@ impl Scope {
});
}
}
Scope::GenericParams { params, .. } => {
Scope::GenericParams { params, def } => {
for param in params.params.iter() {
f(param.name.clone(), ScopeDef::GenericParam(param.idx))
f(
param.name.clone(),
ScopeDef::GenericParam(GenericParam {
parent: (*def).into(),
idx: param.idx,
}),
)
}
}
Scope::ImplBlockScope(i) => {