diff options
author | Ville Penttinen <[email protected]> | 2019-02-27 12:00:08 +0000 |
---|---|---|
committer | Ville Penttinen <[email protected]> | 2019-02-27 12:08:09 +0000 |
commit | d3ce69aee3297e683691ec0123f5a2584a8075a0 (patch) | |
tree | 717f16fc401332de83230f8ae69c4320c2c714cd /crates/ra_hir/src | |
parent | 52054e1140cc2af19825ebef2aea06c48cf79955 (diff) |
Remove `TypeRef` from item opts which implement TypeAscriptionOwner
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/adt.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/code_model_impl/function.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir/src/expr.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir/src/type_ref.rs | 4 |
4 files changed, 10 insertions, 10 deletions
diff --git a/crates/ra_hir/src/adt.rs b/crates/ra_hir/src/adt.rs index 6d917bb1b..325f1d7b6 100644 --- a/crates/ra_hir/src/adt.rs +++ b/crates/ra_hir/src/adt.rs | |||
@@ -6,7 +6,7 @@ use std::sync::Arc; | |||
6 | use ra_arena::{RawId, Arena, impl_arena_id}; | 6 | use ra_arena::{RawId, Arena, impl_arena_id}; |
7 | use ra_syntax::{ | 7 | use ra_syntax::{ |
8 | TreeArc, | 8 | TreeArc, |
9 | ast::{self, NameOwner, StructFlavor} | 9 | ast::{self, NameOwner, StructFlavor, TypeAscriptionOwner} |
10 | }; | 10 | }; |
11 | 11 | ||
12 | use crate::{ | 12 | use crate::{ |
@@ -164,7 +164,7 @@ impl VariantData { | |||
164 | .fields() | 164 | .fields() |
165 | .map(|fd| StructFieldData { | 165 | .map(|fd| StructFieldData { |
166 | name: fd.name().map(|n| n.as_name()).unwrap_or_else(Name::missing), | 166 | name: fd.name().map(|n| n.as_name()).unwrap_or_else(Name::missing), |
167 | type_ref: TypeRef::from_ast_opt(fd.type_ref()), | 167 | type_ref: TypeRef::from_ast_opt(fd.ascribed_type()), |
168 | }) | 168 | }) |
169 | .collect(); | 169 | .collect(); |
170 | VariantDataInner::Struct(fields) | 170 | VariantDataInner::Struct(fields) |
diff --git a/crates/ra_hir/src/code_model_impl/function.rs b/crates/ra_hir/src/code_model_impl/function.rs index c401528c6..c1654b069 100644 --- a/crates/ra_hir/src/code_model_impl/function.rs +++ b/crates/ra_hir/src/code_model_impl/function.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use std::sync::Arc; | 1 | use std::sync::Arc; |
2 | 2 | ||
3 | use ra_syntax::ast::{self, NameOwner}; | 3 | use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; |
4 | 4 | ||
5 | use crate::{ | 5 | use crate::{ |
6 | Name, AsName, Function, FnSignature, | 6 | Name, AsName, Function, FnSignature, |
@@ -19,7 +19,7 @@ impl FnSignature { | |||
19 | let mut has_self_param = false; | 19 | let mut has_self_param = false; |
20 | if let Some(param_list) = node.param_list() { | 20 | if let Some(param_list) = node.param_list() { |
21 | if let Some(self_param) = param_list.self_param() { | 21 | if let Some(self_param) = param_list.self_param() { |
22 | let self_type = if let Some(type_ref) = self_param.type_ref() { | 22 | let self_type = if let Some(type_ref) = self_param.ascribed_type() { |
23 | TypeRef::from_ast(type_ref) | 23 | TypeRef::from_ast(type_ref) |
24 | } else { | 24 | } else { |
25 | let self_type = TypeRef::Path(Name::self_type().into()); | 25 | let self_type = TypeRef::Path(Name::self_type().into()); |
@@ -37,7 +37,7 @@ impl FnSignature { | |||
37 | has_self_param = true; | 37 | has_self_param = true; |
38 | } | 38 | } |
39 | for param in param_list.params() { | 39 | for param in param_list.params() { |
40 | let type_ref = TypeRef::from_ast_opt(param.type_ref()); | 40 | let type_ref = TypeRef::from_ast_opt(param.ascribed_type()); |
41 | params.push(type_ref); | 41 | params.push(type_ref); |
42 | } | 42 | } |
43 | } | 43 | } |
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index e9db8282f..aa39d28ed 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs | |||
@@ -6,7 +6,7 @@ use rustc_hash::FxHashMap; | |||
6 | use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap}; | 6 | use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap}; |
7 | use ra_syntax::{ | 7 | use ra_syntax::{ |
8 | SyntaxNodePtr, AstNode, | 8 | SyntaxNodePtr, AstNode, |
9 | ast::{self, LoopBodyOwner, ArgListOwner, NameOwner, LiteralFlavor} | 9 | ast::{self, LoopBodyOwner, ArgListOwner, NameOwner, LiteralFlavor, TypeAscriptionOwner} |
10 | }; | 10 | }; |
11 | 11 | ||
12 | use crate::{ | 12 | use crate::{ |
@@ -709,7 +709,7 @@ impl ExprCollector { | |||
709 | if let Some(pl) = e.param_list() { | 709 | if let Some(pl) = e.param_list() { |
710 | for param in pl.params() { | 710 | for param in pl.params() { |
711 | let pat = self.collect_pat_opt(param.pat()); | 711 | let pat = self.collect_pat_opt(param.pat()); |
712 | let type_ref = param.type_ref().map(TypeRef::from_ast); | 712 | let type_ref = param.ascribed_type().map(TypeRef::from_ast); |
713 | args.push(pat); | 713 | args.push(pat); |
714 | arg_types.push(type_ref); | 714 | arg_types.push(type_ref); |
715 | } | 715 | } |
@@ -790,7 +790,7 @@ impl ExprCollector { | |||
790 | .map(|s| match s.kind() { | 790 | .map(|s| match s.kind() { |
791 | ast::StmtKind::LetStmt(stmt) => { | 791 | ast::StmtKind::LetStmt(stmt) => { |
792 | let pat = self.collect_pat_opt(stmt.pat()); | 792 | let pat = self.collect_pat_opt(stmt.pat()); |
793 | let type_ref = stmt.type_ref().map(TypeRef::from_ast); | 793 | let type_ref = stmt.ascribed_type().map(TypeRef::from_ast); |
794 | let initializer = stmt.initializer().map(|e| self.collect_expr(e)); | 794 | let initializer = stmt.initializer().map(|e| self.collect_expr(e)); |
795 | Statement::Let { pat, type_ref, initializer } | 795 | Statement::Let { pat, type_ref, initializer } |
796 | } | 796 | } |
diff --git a/crates/ra_hir/src/type_ref.rs b/crates/ra_hir/src/type_ref.rs index ee8b7376a..8aa807648 100644 --- a/crates/ra_hir/src/type_ref.rs +++ b/crates/ra_hir/src/type_ref.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! HIR for references to types. Paths in these are not yet resolved. They can | 1 | //! HIR for references to types. Paths in these are not yet resolved. They can |
2 | //! be directly created from an ast::TypeRef, without further queries. | 2 | //! be directly created from an ast::TypeRef, without further queries. |
3 | 3 | ||
4 | use ra_syntax::ast; | 4 | use ra_syntax::ast::{self, TypeAscriptionOwner}; |
5 | 5 | ||
6 | use crate::Path; | 6 | use crate::Path; |
7 | 7 | ||
@@ -81,7 +81,7 @@ impl TypeRef { | |||
81 | FnPointerType(inner) => { | 81 | FnPointerType(inner) => { |
82 | let ret_ty = TypeRef::from_ast_opt(inner.ret_type().and_then(|rt| rt.type_ref())); | 82 | let ret_ty = TypeRef::from_ast_opt(inner.ret_type().and_then(|rt| rt.type_ref())); |
83 | let mut params = if let Some(pl) = inner.param_list() { | 83 | let mut params = if let Some(pl) = inner.param_list() { |
84 | pl.params().map(|p| p.type_ref()).map(TypeRef::from_ast_opt).collect() | 84 | pl.params().map(|p| p.ascribed_type()).map(TypeRef::from_ast_opt).collect() |
85 | } else { | 85 | } else { |
86 | Vec::new() | 86 | Vec::new() |
87 | }; | 87 | }; |