@@ -61,6 +61,8 @@ pub enum Data {
61
61
VariableRefData ( VariableRefData ) ,
62
62
/// Data for a reference to a type or trait.
63
63
TypeRefData ( TypeRefData ) ,
64
+ /// Data about a method call.
65
+ MethodCallData ( MethodCallData ) ,
64
66
}
65
67
66
68
/// Data for all kinds of functions and methods.
@@ -137,6 +139,16 @@ pub struct TypeRefData {
137
139
pub ref_id : DefId ,
138
140
}
139
141
142
+ /// Data about a method call.
143
+ #[ derive( Debug ) ]
144
+ pub struct MethodCallData {
145
+ pub span : Span ,
146
+ pub scope : NodeId ,
147
+ pub ref_id : Option < DefId > ,
148
+ pub decl_id : Option < DefId > ,
149
+ }
150
+
151
+
140
152
141
153
impl < ' l , ' tcx : ' l > SaveContext < ' l , ' tcx > {
142
154
pub fn new ( tcx : & ' l ty:: ctxt < ' tcx > ,
@@ -372,6 +384,21 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
372
384
}
373
385
}
374
386
}
387
+ ast:: ExprMethodCall ( ..) => {
388
+ let method_call = ty:: MethodCall :: expr ( expr. id ) ;
389
+ let method_id = self . tcx . tables . borrow ( ) . method_map [ & method_call] . def_id ;
390
+ let ( def_id, decl_id) = match self . tcx . impl_or_trait_item ( method_id) . container ( ) {
391
+ ty:: ImplContainer ( _) => ( Some ( method_id) , None ) ,
392
+ ty:: TraitContainer ( _) => ( None , Some ( method_id) )
393
+ } ;
394
+ let sub_span = self . span_utils . sub_span_for_meth_name ( expr. span ) ;
395
+ Some ( Data :: MethodCallData ( MethodCallData {
396
+ span : sub_span. unwrap ( ) ,
397
+ scope : self . tcx . map . get_enclosing_scope ( expr. id ) . unwrap_or ( 0 ) ,
398
+ ref_id : def_id,
399
+ decl_id : decl_id,
400
+ } ) )
401
+ }
375
402
_ => {
376
403
// FIXME
377
404
unimplemented ! ( ) ;
0 commit comments