aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-11-22 15:51:53 +0000
committerAleksey Kladov <[email protected]>2019-11-22 15:51:53 +0000
commitfe119fef2746bade402fb73dcba8cde49779654d (patch)
tree895e5bb04a4a632b4069bf66f8c7770cfa80a90d /crates/ra_hir/src
parentd4f4ae0dd88f0baf0065d612f41fea3d54af79fd (diff)
Hide data from public API
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/code_model.rs12
-rw-r--r--crates/ra_hir/src/ty/infer.rs8
-rw-r--r--crates/ra_hir/src/ty/lower.rs4
3 files changed, 8 insertions, 16 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 1b65eefe5..af07b2c4d 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -10,7 +10,7 @@ use hir_def::{
10 adt::VariantData, 10 adt::VariantData,
11 body::scope::ExprScopes, 11 body::scope::ExprScopes,
12 builtin_type::BuiltinType, 12 builtin_type::BuiltinType,
13 data::{ConstData, TraitData}, 13 data::TraitData,
14 nameres::per_ns::PerNs, 14 nameres::per_ns::PerNs,
15 resolver::{HasResolver, TypeNs}, 15 resolver::{HasResolver, TypeNs},
16 type_ref::TypeRef, 16 type_ref::TypeRef,
@@ -644,12 +644,8 @@ impl Const {
644 Some(self.module(db).krate()) 644 Some(self.module(db).krate())
645 } 645 }
646 646
647 pub fn data(self, db: &impl HirDatabase) -> Arc<ConstData> {
648 db.const_data(self.id)
649 }
650
651 pub fn name(self, db: &impl HirDatabase) -> Option<Name> { 647 pub fn name(self, db: &impl HirDatabase) -> Option<Name> {
652 self.data(db).name.clone() 648 db.const_data(self.id).name.clone()
653 } 649 }
654 650
655 pub fn infer(self, db: &impl HirDatabase) -> Arc<InferenceResult> { 651 pub fn infer(self, db: &impl HirDatabase) -> Arc<InferenceResult> {
@@ -695,10 +691,6 @@ impl Static {
695 Some(self.module(db).krate()) 691 Some(self.module(db).krate())
696 } 692 }
697 693
698 pub fn data(self, db: &impl HirDatabase) -> Arc<ConstData> {
699 db.static_data(self.id)
700 }
701
702 pub fn infer(self, db: &impl HirDatabase) -> Arc<InferenceResult> { 694 pub fn infer(self, db: &impl HirDatabase) -> Arc<InferenceResult> {
703 db.infer(self.into()) 695 db.infer(self.into())
704 } 696 }
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs
index 39976a359..471bdc387 100644
--- a/crates/ra_hir/src/ty/infer.rs
+++ b/crates/ra_hir/src/ty/infer.rs
@@ -69,10 +69,10 @@ pub fn infer_query(db: &impl HirDatabase, def: DefWithBody) -> Arc<InferenceResu
69 let resolver = DefWithBodyId::from(def).resolver(db); 69 let resolver = DefWithBodyId::from(def).resolver(db);
70 let mut ctx = InferenceContext::new(db, def, resolver); 70 let mut ctx = InferenceContext::new(db, def, resolver);
71 71
72 match def { 72 match &def {
73 DefWithBody::Const(ref c) => ctx.collect_const(&c.data(db)), 73 DefWithBody::Const(c) => ctx.collect_const(&db.const_data(c.id)),
74 DefWithBody::Function(ref f) => ctx.collect_fn(&db.function_data(f.id)), 74 DefWithBody::Function(f) => ctx.collect_fn(&db.function_data(f.id)),
75 DefWithBody::Static(ref s) => ctx.collect_const(&s.data(db)), 75 DefWithBody::Static(s) => ctx.collect_const(&db.static_data(s.id)),
76 } 76 }
77 77
78 ctx.infer_body(); 78 ctx.infer_body();
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs
index ac7f3f775..2272510e8 100644
--- a/crates/ra_hir/src/ty/lower.rs
+++ b/crates/ra_hir/src/ty/lower.rs
@@ -639,7 +639,7 @@ fn type_for_fn(db: &impl HirDatabase, def: Function) -> Ty {
639 639
640/// Build the declared type of a const. 640/// Build the declared type of a const.
641fn type_for_const(db: &impl HirDatabase, def: Const) -> Ty { 641fn type_for_const(db: &impl HirDatabase, def: Const) -> Ty {
642 let data = def.data(db); 642 let data = db.const_data(def.id);
643 let resolver = def.id.resolver(db); 643 let resolver = def.id.resolver(db);
644 644
645 Ty::from_hir(db, &resolver, &data.type_ref) 645 Ty::from_hir(db, &resolver, &data.type_ref)
@@ -647,7 +647,7 @@ fn type_for_const(db: &impl HirDatabase, def: Const) -> Ty {
647 647
648/// Build the declared type of a static. 648/// Build the declared type of a static.
649fn type_for_static(db: &impl HirDatabase, def: Static) -> Ty { 649fn type_for_static(db: &impl HirDatabase, def: Static) -> Ty {
650 let data = def.data(db); 650 let data = db.static_data(def.id);
651 let resolver = def.id.resolver(db); 651 let resolver = def.id.resolver(db);
652 652
653 Ty::from_hir(db, &resolver, &data.type_ref) 653 Ty::from_hir(db, &resolver, &data.type_ref)