aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/data.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/data.rs')
-rw-r--r--crates/ra_hir_def/src/data.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs
index 04bd4a305..934c3b94e 100644
--- a/crates/ra_hir_def/src/data.rs
+++ b/crates/ra_hir_def/src/data.rs
@@ -3,6 +3,7 @@
3use std::sync::Arc; 3use std::sync::Arc;
4 4
5use hir_expand::{ 5use hir_expand::{
6 hygiene::Hygiene,
6 name::{name, AsName, Name}, 7 name::{name, AsName, Name},
7 AstId, InFile, 8 AstId, InFile,
8}; 9};
@@ -12,6 +13,7 @@ use ra_syntax::ast::{
12}; 13};
13 14
14use crate::{ 15use crate::{
16 attr::Attrs,
15 db::DefDatabase, 17 db::DefDatabase,
16 path::{path, GenericArgs, Path}, 18 path::{path, GenericArgs, Path},
17 src::HasSource, 19 src::HasSource,
@@ -26,6 +28,7 @@ pub struct FunctionData {
26 pub name: Name, 28 pub name: Name,
27 pub params: Vec<TypeRef>, 29 pub params: Vec<TypeRef>,
28 pub ret_type: TypeRef, 30 pub ret_type: TypeRef,
31 pub attrs: Attrs,
29 /// True if the first param is `self`. This is relevant to decide whether this 32 /// True if the first param is `self`. This is relevant to decide whether this
30 /// can be called as a method. 33 /// can be called as a method.
31 pub has_self_param: bool, 34 pub has_self_param: bool,
@@ -63,6 +66,7 @@ impl FunctionData {
63 params.push(type_ref); 66 params.push(type_ref);
64 } 67 }
65 } 68 }
69 let attrs = Attrs::new(&src.value, &Hygiene::new(db.upcast(), src.file_id));
66 let ret_type = if let Some(type_ref) = src.value.ret_type().and_then(|rt| rt.type_ref()) { 70 let ret_type = if let Some(type_ref) = src.value.ret_type().and_then(|rt| rt.type_ref()) {
67 TypeRef::from_ast(type_ref) 71 TypeRef::from_ast(type_ref)
68 } else { 72 } else {
@@ -81,7 +85,7 @@ impl FunctionData {
81 let visibility = 85 let visibility =
82 RawVisibility::from_ast_with_default(db, vis_default, src.map(|s| s.visibility())); 86 RawVisibility::from_ast_with_default(db, vis_default, src.map(|s| s.visibility()));
83 87
84 let sig = FunctionData { name, params, ret_type, has_self_param, visibility }; 88 let sig = FunctionData { name, params, ret_type, has_self_param, visibility, attrs };
85 Arc::new(sig) 89 Arc::new(sig)
86 } 90 }
87} 91}