From ca1af86e7bb104533f9878f84a7a3a39e5107c30 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 21 Nov 2019 14:22:30 +0300 Subject: Use GenericParam in ScopeDef --- crates/ra_hir/src/code_model.rs | 2 +- crates/ra_hir/src/resolve.rs | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 39b01d510..3c891547e 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -1070,7 +1070,7 @@ pub struct ImplBlock { pub enum ScopeDef { ModuleDef(ModuleDef), MacroDef(MacroDef), - GenericParam(u32), + GenericParam(GenericParam), ImplSelfType(ImplBlock), AdtSelfType(Adt), Local(Local), diff --git a/crates/ra_hir/src/resolve.rs b/crates/ra_hir/src/resolve.rs index 5e04ca9b6..a029513b5 100644 --- a/crates/ra_hir/src/resolve.rs +++ b/crates/ra_hir/src/resolve.rs @@ -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) => { -- cgit v1.2.3