aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/adt.rs28
-rw-r--r--crates/ra_hir/src/code_model_impl/function.rs8
-rw-r--r--crates/ra_hir/src/expr.rs18
3 files changed, 27 insertions, 27 deletions
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;
6use ra_arena::{RawId, Arena, impl_arena_id}; 6use ra_arena::{RawId, Arena, impl_arena_id};
7use ra_syntax::{ 7use ra_syntax::{
8 TreeArc, 8 TreeArc,
9 ast::{self, NameOwner, StructFlavor, TypeAscriptionOwner} 9 ast::{self, NameOwner, StructKind, TypeAscriptionOwner}
10}; 10};
11 11
12use crate::{ 12use crate::{
@@ -47,7 +47,7 @@ pub struct StructData {
47impl StructData { 47impl StructData {
48 fn new(struct_def: &ast::StructDef) -> StructData { 48 fn new(struct_def: &ast::StructDef) -> StructData {
49 let name = struct_def.name().map(|n| n.as_name()); 49 let name = struct_def.name().map(|n| n.as_name());
50 let variant_data = VariantData::new(struct_def.flavor()); 50 let variant_data = VariantData::new(struct_def.kind());
51 let variant_data = Arc::new(variant_data); 51 let variant_data = Arc::new(variant_data);
52 StructData { name, variant_data } 52 StructData { name, variant_data }
53 } 53 }
@@ -94,7 +94,7 @@ impl EnumData {
94 let variants = variants(&*enum_def) 94 let variants = variants(&*enum_def)
95 .map(|var| EnumVariantData { 95 .map(|var| EnumVariantData {
96 name: var.name().map(|it| it.as_name()), 96 name: var.name().map(|it| it.as_name()),
97 variant_data: Arc::new(VariantData::new(var.flavor())), 97 variant_data: Arc::new(VariantData::new(var.kind())),
98 }) 98 })
99 .collect(); 99 .collect();
100 Arc::new(EnumData { name, variants }) 100 Arc::new(EnumData { name, variants })
@@ -143,9 +143,9 @@ impl VariantData {
143} 143}
144 144
145impl VariantData { 145impl VariantData {
146 fn new(flavor: StructFlavor) -> Self { 146 fn new(flavor: StructKind) -> Self {
147 let inner = match flavor { 147 let inner = match flavor {
148 ast::StructFlavor::Tuple(fl) => { 148 ast::StructKind::Tuple(fl) => {
149 let fields = fl 149 let fields = fl
150 .fields() 150 .fields()
151 .enumerate() 151 .enumerate()
@@ -156,7 +156,7 @@ impl VariantData {
156 .collect(); 156 .collect();
157 VariantDataInner::Tuple(fields) 157 VariantDataInner::Tuple(fields)
158 } 158 }
159 ast::StructFlavor::Named(fl) => { 159 ast::StructKind::Named(fl) => {
160 let fields = fl 160 let fields = fl
161 .fields() 161 .fields()
162 .map(|fd| StructFieldData { 162 .map(|fd| StructFieldData {
@@ -166,7 +166,7 @@ impl VariantData {
166 .collect(); 166 .collect();
167 VariantDataInner::Struct(fields) 167 VariantDataInner::Struct(fields)
168 } 168 }
169 ast::StructFlavor::Unit => VariantDataInner::Unit, 169 ast::StructKind::Unit => VariantDataInner::Unit,
170 }; 170 };
171 VariantData(inner) 171 VariantData(inner)
172 } 172 }
@@ -200,27 +200,27 @@ impl StructField {
200 let fields = var_data.fields().unwrap(); 200 let fields = var_data.fields().unwrap();
201 let ss; 201 let ss;
202 let es; 202 let es;
203 let (file_id, struct_flavor) = match self.parent { 203 let (file_id, struct_kind) = match self.parent {
204 VariantDef::Struct(s) => { 204 VariantDef::Struct(s) => {
205 let (file_id, source) = s.source(db); 205 let (file_id, source) = s.source(db);
206 ss = source; 206 ss = source;
207 (file_id, ss.flavor()) 207 (file_id, ss.kind())
208 } 208 }
209 VariantDef::EnumVariant(e) => { 209 VariantDef::EnumVariant(e) => {
210 let (file_id, source) = e.source(db); 210 let (file_id, source) = e.source(db);
211 es = source; 211 es = source;
212 (file_id, es.flavor()) 212 (file_id, es.kind())
213 } 213 }
214 }; 214 };
215 215
216 let field_sources = match struct_flavor { 216 let field_sources = match struct_kind {
217 ast::StructFlavor::Tuple(fl) => { 217 ast::StructKind::Tuple(fl) => {
218 fl.fields().map(|it| FieldSource::Pos(it.to_owned())).collect() 218 fl.fields().map(|it| FieldSource::Pos(it.to_owned())).collect()
219 } 219 }
220 ast::StructFlavor::Named(fl) => { 220 ast::StructKind::Named(fl) => {
221 fl.fields().map(|it| FieldSource::Named(it.to_owned())).collect() 221 fl.fields().map(|it| FieldSource::Named(it.to_owned())).collect()
222 } 222 }
223 ast::StructFlavor::Unit => Vec::new(), 223 ast::StructKind::Unit => Vec::new(),
224 }; 224 };
225 let field = field_sources 225 let field = field_sources
226 .into_iter() 226 .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 {
20 TypeRef::from_ast(type_ref) 20 TypeRef::from_ast(type_ref)
21 } else { 21 } else {
22 let self_type = TypeRef::Path(Name::self_type().into()); 22 let self_type = TypeRef::Path(Name::self_type().into());
23 match self_param.flavor() { 23 match self_param.kind() {
24 ast::SelfParamFlavor::Owned => self_type, 24 ast::SelfParamKind::Owned => self_type,
25 ast::SelfParamFlavor::Ref => { 25 ast::SelfParamKind::Ref => {
26 TypeRef::Reference(Box::new(self_type), Mutability::Shared) 26 TypeRef::Reference(Box::new(self_type), Mutability::Shared)
27 } 27 }
28 ast::SelfParamFlavor::MutRef => { 28 ast::SelfParamKind::MutRef => {
29 TypeRef::Reference(Box::new(self_type), Mutability::Mut) 29 TypeRef::Reference(Box::new(self_type), Mutability::Mut)
30 } 30 }
31 } 31 }
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;
6use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap}; 6use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap};
7use ra_syntax::{ 7use ra_syntax::{
8 SyntaxNodePtr, AstPtr, AstNode, 8 SyntaxNodePtr, AstPtr, AstNode,
9 ast::{self, LoopBodyOwner, ArgListOwner, NameOwner, LiteralFlavor, TypeAscriptionOwner} 9 ast::{self, LoopBodyOwner, ArgListOwner, NameOwner, LiteralKind, TypeAscriptionOwner}
10}; 10};
11 11
12use crate::{ 12use crate::{
@@ -726,8 +726,8 @@ impl ExprCollector {
726 self.alloc_expr(Expr::Array { exprs }, syntax_ptr) 726 self.alloc_expr(Expr::Array { exprs }, syntax_ptr)
727 } 727 }
728 ast::ExprKind::Literal(e) => { 728 ast::ExprKind::Literal(e) => {
729 let lit = match e.flavor() { 729 let lit = match e.kind() {
730 LiteralFlavor::IntNumber { suffix } => { 730 LiteralKind::IntNumber { suffix } => {
731 let known_name = suffix 731 let known_name = suffix
732 .and_then(|it| IntTy::from_suffix(&it).map(UncertainIntTy::Known)); 732 .and_then(|it| IntTy::from_suffix(&it).map(UncertainIntTy::Known));
733 733
@@ -736,7 +736,7 @@ impl ExprCollector {
736 known_name.unwrap_or(UncertainIntTy::Unknown), 736 known_name.unwrap_or(UncertainIntTy::Unknown),
737 ) 737 )
738 } 738 }
739 LiteralFlavor::FloatNumber { suffix } => { 739 LiteralKind::FloatNumber { suffix } => {
740 let known_name = suffix 740 let known_name = suffix
741 .and_then(|it| FloatTy::from_suffix(&it).map(UncertainFloatTy::Known)); 741 .and_then(|it| FloatTy::from_suffix(&it).map(UncertainFloatTy::Known));
742 742
@@ -745,13 +745,13 @@ impl ExprCollector {
745 known_name.unwrap_or(UncertainFloatTy::Unknown), 745 known_name.unwrap_or(UncertainFloatTy::Unknown),
746 ) 746 )
747 } 747 }
748 LiteralFlavor::ByteString => Literal::ByteString(Default::default()), 748 LiteralKind::ByteString => Literal::ByteString(Default::default()),
749 LiteralFlavor::String => Literal::String(Default::default()), 749 LiteralKind::String => Literal::String(Default::default()),
750 LiteralFlavor::Byte => { 750 LiteralKind::Byte => {
751 Literal::Int(Default::default(), UncertainIntTy::Known(IntTy::u8())) 751 Literal::Int(Default::default(), UncertainIntTy::Known(IntTy::u8()))
752 } 752 }
753 LiteralFlavor::Bool => Literal::Bool(Default::default()), 753 LiteralKind::Bool => Literal::Bool(Default::default()),
754 LiteralFlavor::Char => Literal::Char(Default::default()), 754 LiteralKind::Char => Literal::Char(Default::default()),
755 }; 755 };
756 self.alloc_expr(Expr::Literal(lit), syntax_ptr) 756 self.alloc_expr(Expr::Literal(lit), syntax_ptr)
757 } 757 }