mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Make ImplData's fields public
This commit is contained in:
parent
b315f05cf1
commit
64df759418
@ -10,9 +10,9 @@ use hir_def::{
|
||||
adt::VariantData,
|
||||
body::scope::ExprScopes,
|
||||
builtin_type::BuiltinType,
|
||||
data::TraitData,
|
||||
nameres::per_ns::PerNs,
|
||||
resolver::{HasResolver, TypeNs},
|
||||
traits::TraitData,
|
||||
type_ref::TypeRef,
|
||||
ContainerId, CrateModuleId, HasModule, ImplId, LocalEnumVariantId, LocalStructFieldId, Lookup,
|
||||
ModuleId, UnionId,
|
||||
|
@ -18,11 +18,11 @@ impl HasSource for ImplBlock {
|
||||
|
||||
impl ImplBlock {
|
||||
pub fn target_trait(&self, db: &impl DefDatabase) -> Option<TypeRef> {
|
||||
db.impl_data(self.id).target_trait().cloned()
|
||||
db.impl_data(self.id).target_trait.clone()
|
||||
}
|
||||
|
||||
pub fn target_type(&self, db: &impl DefDatabase) -> TypeRef {
|
||||
db.impl_data(self.id).target_type().clone()
|
||||
db.impl_data(self.id).target_type.clone()
|
||||
}
|
||||
|
||||
pub fn target_ty(&self, db: &impl HirDatabase) -> Ty {
|
||||
@ -35,11 +35,11 @@ impl ImplBlock {
|
||||
}
|
||||
|
||||
pub fn items(&self, db: &impl DefDatabase) -> Vec<AssocItem> {
|
||||
db.impl_data(self.id).items().iter().map(|it| (*it).into()).collect()
|
||||
db.impl_data(self.id).items.iter().map(|it| (*it).into()).collect()
|
||||
}
|
||||
|
||||
pub fn is_negative(&self, db: &impl DefDatabase) -> bool {
|
||||
db.impl_data(self.id).is_negative()
|
||||
db.impl_data(self.id).is_negative
|
||||
}
|
||||
|
||||
pub fn module(&self, db: &impl DefDatabase) -> Module {
|
||||
|
@ -22,7 +22,7 @@ use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue};
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use hir_def::{
|
||||
function::FunctionData,
|
||||
data::FunctionData,
|
||||
path::known,
|
||||
resolver::{HasResolver, Resolver, TypeNs},
|
||||
type_ref::{Mutability, TypeRef},
|
||||
|
@ -1,3 +1,5 @@
|
||||
//! Contains basic data about various HIR declarations.
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use hir_expand::{
|
||||
@ -135,10 +137,10 @@ impl TraitData {
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct ImplData {
|
||||
target_trait: Option<TypeRef>,
|
||||
target_type: TypeRef,
|
||||
items: Vec<AssocItemId>,
|
||||
negative: bool,
|
||||
pub target_trait: Option<TypeRef>,
|
||||
pub target_type: TypeRef,
|
||||
pub items: Vec<AssocItemId>,
|
||||
pub is_negative: bool,
|
||||
}
|
||||
|
||||
impl ImplData {
|
||||
@ -148,7 +150,7 @@ impl ImplData {
|
||||
|
||||
let target_trait = src.value.target_trait().map(TypeRef::from_ast);
|
||||
let target_type = TypeRef::from_ast_opt(src.value.target_type());
|
||||
let negative = src.value.is_negative();
|
||||
let is_negative = src.value.is_negative();
|
||||
|
||||
let items = if let Some(item_list) = src.value.item_list() {
|
||||
item_list
|
||||
@ -184,23 +186,7 @@ impl ImplData {
|
||||
Vec::new()
|
||||
};
|
||||
|
||||
let res = ImplData { target_trait, target_type, items, negative };
|
||||
let res = ImplData { target_trait, target_type, items, is_negative };
|
||||
Arc::new(res)
|
||||
}
|
||||
|
||||
pub fn target_trait(&self) -> Option<&TypeRef> {
|
||||
self.target_trait.as_ref()
|
||||
}
|
||||
|
||||
pub fn target_type(&self) -> &TypeRef {
|
||||
&self.target_type
|
||||
}
|
||||
|
||||
pub fn items(&self) -> &[AssocItemId] {
|
||||
&self.items
|
||||
}
|
||||
|
||||
pub fn is_negative(&self) -> bool {
|
||||
self.negative
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user