@@ -61,6 +61,8 @@ pub enum Data {
6161 VariableRefData ( VariableRefData ) ,
6262 /// Data for a reference to a type or trait.
6363 TypeRefData ( TypeRefData ) ,
64+ /// Data about a method call.
65+ MethodCallData ( MethodCallData ) ,
6466}
6567
6668/// Data for all kinds of functions and methods.
@@ -137,6 +139,16 @@ pub struct TypeRefData {
137139 pub ref_id : DefId ,
138140}
139141
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+
140152
141153impl < ' l , ' tcx : ' l > SaveContext < ' l , ' tcx > {
142154 pub fn new ( tcx : & ' l ty:: ctxt < ' tcx > ,
@@ -372,6 +384,21 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
372384 }
373385 }
374386 }
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+ }
375402 _ => {
376403 // FIXME
377404 unimplemented ! ( ) ;
0 commit comments