From 0e1e40676a82af782da2593c258c9af52ab78757 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 2 Apr 2019 12:48:14 +0300 Subject: rename flavor to kind --- crates/ra_hir/src/adt.rs | 28 +++++++++++++-------------- crates/ra_hir/src/code_model_impl/function.rs | 8 ++++---- crates/ra_hir/src/expr.rs | 18 ++++++++--------- 3 files changed, 27 insertions(+), 27 deletions(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/adt.rs b/crates/ra_hir/src/adt.rs index 78ea8976b..e027eedd9 100644 --- a/crates/ra_hir/src/adt.rs +++ b/crates/ra_hir/src/adt.rs @@ -6,7 +6,7 @@ use std::sync::Arc; use ra_arena::{RawId, Arena, impl_arena_id}; use ra_syntax::{ TreeArc, - ast::{self, NameOwner, StructFlavor, TypeAscriptionOwner} + ast::{self, NameOwner, StructKind, TypeAscriptionOwner} }; use crate::{ @@ -47,7 +47,7 @@ pub struct StructData { impl StructData { fn new(struct_def: &ast::StructDef) -> StructData { let name = struct_def.name().map(|n| n.as_name()); - let variant_data = VariantData::new(struct_def.flavor()); + let variant_data = VariantData::new(struct_def.kind()); let variant_data = Arc::new(variant_data); StructData { name, variant_data } } @@ -94,7 +94,7 @@ impl EnumData { let variants = variants(&*enum_def) .map(|var| EnumVariantData { name: var.name().map(|it| it.as_name()), - variant_data: Arc::new(VariantData::new(var.flavor())), + variant_data: Arc::new(VariantData::new(var.kind())), }) .collect(); Arc::new(EnumData { name, variants }) @@ -143,9 +143,9 @@ impl VariantData { } impl VariantData { - fn new(flavor: StructFlavor) -> Self { + fn new(flavor: StructKind) -> Self { let inner = match flavor { - ast::StructFlavor::Tuple(fl) => { + ast::StructKind::Tuple(fl) => { let fields = fl .fields() .enumerate() @@ -156,7 +156,7 @@ impl VariantData { .collect(); VariantDataInner::Tuple(fields) } - ast::StructFlavor::Named(fl) => { + ast::StructKind::Named(fl) => { let fields = fl .fields() .map(|fd| StructFieldData { @@ -166,7 +166,7 @@ impl VariantData { .collect(); VariantDataInner::Struct(fields) } - ast::StructFlavor::Unit => VariantDataInner::Unit, + ast::StructKind::Unit => VariantDataInner::Unit, }; VariantData(inner) } @@ -200,27 +200,27 @@ impl StructField { let fields = var_data.fields().unwrap(); let ss; let es; - let (file_id, struct_flavor) = match self.parent { + let (file_id, struct_kind) = match self.parent { VariantDef::Struct(s) => { let (file_id, source) = s.source(db); ss = source; - (file_id, ss.flavor()) + (file_id, ss.kind()) } VariantDef::EnumVariant(e) => { let (file_id, source) = e.source(db); es = source; - (file_id, es.flavor()) + (file_id, es.kind()) } }; - let field_sources = match struct_flavor { - ast::StructFlavor::Tuple(fl) => { + let field_sources = match struct_kind { + ast::StructKind::Tuple(fl) => { fl.fields().map(|it| FieldSource::Pos(it.to_owned())).collect() } - ast::StructFlavor::Named(fl) => { + ast::StructKind::Named(fl) => { fl.fields().map(|it| FieldSource::Named(it.to_owned())).collect() } - ast::StructFlavor::Unit => Vec::new(), + ast::StructKind::Unit => Vec::new(), }; let field = field_sources .into_iter() diff --git a/crates/ra_hir/src/code_model_impl/function.rs b/crates/ra_hir/src/code_model_impl/function.rs index 334cb302b..f8bd0f784 100644 --- a/crates/ra_hir/src/code_model_impl/function.rs +++ b/crates/ra_hir/src/code_model_impl/function.rs @@ -20,12 +20,12 @@ impl FnSignature { TypeRef::from_ast(type_ref) } else { let self_type = TypeRef::Path(Name::self_type().into()); - match self_param.flavor() { - ast::SelfParamFlavor::Owned => self_type, - ast::SelfParamFlavor::Ref => { + match self_param.kind() { + ast::SelfParamKind::Owned => self_type, + ast::SelfParamKind::Ref => { TypeRef::Reference(Box::new(self_type), Mutability::Shared) } - ast::SelfParamFlavor::MutRef => { + ast::SelfParamKind::MutRef => { TypeRef::Reference(Box::new(self_type), Mutability::Mut) } } diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index ee2c4475c..45012827f 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs @@ -6,7 +6,7 @@ use rustc_hash::FxHashMap; use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap}; use ra_syntax::{ SyntaxNodePtr, AstPtr, AstNode, - ast::{self, LoopBodyOwner, ArgListOwner, NameOwner, LiteralFlavor, TypeAscriptionOwner} + ast::{self, LoopBodyOwner, ArgListOwner, NameOwner, LiteralKind, TypeAscriptionOwner} }; use crate::{ @@ -726,8 +726,8 @@ impl ExprCollector { self.alloc_expr(Expr::Array { exprs }, syntax_ptr) } ast::ExprKind::Literal(e) => { - let lit = match e.flavor() { - LiteralFlavor::IntNumber { suffix } => { + let lit = match e.kind() { + LiteralKind::IntNumber { suffix } => { let known_name = suffix .and_then(|it| IntTy::from_suffix(&it).map(UncertainIntTy::Known)); @@ -736,7 +736,7 @@ impl ExprCollector { known_name.unwrap_or(UncertainIntTy::Unknown), ) } - LiteralFlavor::FloatNumber { suffix } => { + LiteralKind::FloatNumber { suffix } => { let known_name = suffix .and_then(|it| FloatTy::from_suffix(&it).map(UncertainFloatTy::Known)); @@ -745,13 +745,13 @@ impl ExprCollector { known_name.unwrap_or(UncertainFloatTy::Unknown), ) } - LiteralFlavor::ByteString => Literal::ByteString(Default::default()), - LiteralFlavor::String => Literal::String(Default::default()), - LiteralFlavor::Byte => { + LiteralKind::ByteString => Literal::ByteString(Default::default()), + LiteralKind::String => Literal::String(Default::default()), + LiteralKind::Byte => { Literal::Int(Default::default(), UncertainIntTy::Known(IntTy::u8())) } - LiteralFlavor::Bool => Literal::Bool(Default::default()), - LiteralFlavor::Char => Literal::Char(Default::default()), + LiteralKind::Bool => Literal::Bool(Default::default()), + LiteralKind::Char => Literal::Char(Default::default()), }; self.alloc_expr(Expr::Literal(lit), syntax_ptr) } -- cgit v1.2.3