aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src
diff options
context:
space:
mode:
authoradamrk <[email protected]>2020-09-01 21:13:12 +0100
committeradamrk <[email protected]>2020-09-01 21:13:12 +0100
commit04fc937700105951442a9b6fa30591fb48a1e879 (patch)
treee790fd0d19c30457b7aaae90eb898de791bc4511 /crates/hir/src
parentc6ddb907144688ae77a6de3666159feef53638e1 (diff)
Add back Param struct
Diffstat (limited to 'crates/hir/src')
-rw-r--r--crates/hir/src/code_model.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs
index f182ab228..afbf78b3b 100644
--- a/crates/hir/src/code_model.rs
+++ b/crates/hir/src/code_model.rs
@@ -708,7 +708,7 @@ impl Function {
708 Some(SelfParam { func: self.id }) 708 Some(SelfParam { func: self.id })
709 } 709 }
710 710
711 pub fn params(self, db: &dyn HirDatabase) -> Vec<Type> { 711 pub fn params(self, db: &dyn HirDatabase) -> Vec<Param> {
712 let resolver = self.id.resolver(db.upcast()); 712 let resolver = self.id.resolver(db.upcast());
713 let ctx = hir_ty::TyLoweringContext::new(db, &resolver); 713 let ctx = hir_ty::TyLoweringContext::new(db, &resolver);
714 let environment = TraitEnvironment::lower(db, &resolver); 714 let environment = TraitEnvironment::lower(db, &resolver);
@@ -724,7 +724,7 @@ impl Function {
724 environment: environment.clone(), 724 environment: environment.clone(),
725 }, 725 },
726 }; 726 };
727 ty 727 Param { ty }
728 }) 728 })
729 .collect() 729 .collect()
730 } 730 }
@@ -754,6 +754,16 @@ impl From<Mutability> for Access {
754 } 754 }
755} 755}
756 756
757pub struct Param {
758 ty: Type,
759}
760
761impl Param {
762 pub fn ty(&self) -> &Type {
763 &self.ty
764 }
765}
766
757#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 767#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
758pub struct SelfParam { 768pub struct SelfParam {
759 func: FunctionId, 769 func: FunctionId,