@@ -268,80 +268,6 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
268
268
}
269
269
}
270
270
271
- fn process_def_kind (
272
- & mut self ,
273
- ref_id : NodeId ,
274
- span : Span ,
275
- sub_span : Option < Span > ,
276
- def_id : DefId ,
277
- ) {
278
- if self . span . filter_generated ( sub_span, span) {
279
- return ;
280
- }
281
-
282
- let def = self . save_ctxt . get_path_def ( ref_id) ;
283
- match def {
284
- HirDef :: Mod ( _) => {
285
- let span = self . span_from_span ( sub_span. expect ( "No span found for mod ref" ) ) ;
286
- self . dumper . dump_ref ( Ref {
287
- kind : RefKind :: Mod ,
288
- span,
289
- ref_id : :: id_from_def_id ( def_id) ,
290
- } ) ;
291
- }
292
- HirDef :: Struct ( ..) |
293
- HirDef :: Variant ( ..) |
294
- HirDef :: Union ( ..) |
295
- HirDef :: Enum ( ..) |
296
- HirDef :: TyAlias ( ..) |
297
- HirDef :: TyForeign ( ..) |
298
- HirDef :: TraitAlias ( ..) |
299
- HirDef :: Trait ( _) => {
300
- let span = self . span_from_span ( sub_span. expect ( "No span found for type ref" ) ) ;
301
- self . dumper . dump_ref ( Ref {
302
- kind : RefKind :: Type ,
303
- span,
304
- ref_id : :: id_from_def_id ( def_id) ,
305
- } ) ;
306
- }
307
- HirDef :: Static ( ..) |
308
- HirDef :: Const ( ..) |
309
- HirDef :: StructCtor ( ..) |
310
- HirDef :: VariantCtor ( ..) => {
311
- let span = self . span_from_span ( sub_span. expect ( "No span found for var ref" ) ) ;
312
- self . dumper . dump_ref ( Ref {
313
- kind : RefKind :: Variable ,
314
- span,
315
- ref_id : :: id_from_def_id ( def_id) ,
316
- } ) ;
317
- }
318
- HirDef :: Fn ( ..) => {
319
- let span = self . span_from_span ( sub_span. expect ( "No span found for fn ref" ) ) ;
320
- self . dumper . dump_ref ( Ref {
321
- kind : RefKind :: Function ,
322
- span,
323
- ref_id : :: id_from_def_id ( def_id) ,
324
- } ) ;
325
- }
326
- // With macros 2.0, we can legitimately get a ref to a macro, but
327
- // we don't handle it properly for now (FIXME).
328
- HirDef :: Macro ( ..) => { }
329
- HirDef :: Local ( ..) |
330
- HirDef :: Upvar ( ..) |
331
- HirDef :: SelfTy ( ..) |
332
- HirDef :: Label ( _) |
333
- HirDef :: TyParam ( ..) |
334
- HirDef :: Method ( ..) |
335
- HirDef :: AssociatedTy ( ..) |
336
- HirDef :: AssociatedConst ( ..) |
337
- HirDef :: PrimTy ( _) |
338
- HirDef :: GlobalAsm ( _) |
339
- HirDef :: Err => {
340
- span_bug ! ( span, "process_def_kind for unexpected item: {:?}" , def) ;
341
- }
342
- }
343
- }
344
-
345
271
fn process_formals ( & mut self , formals : & ' l [ ast:: Arg ] , qualname : & str ) {
346
272
for arg in formals {
347
273
self . visit_pat ( & arg. pat ) ;
@@ -1348,29 +1274,17 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
1348
1274
} ;
1349
1275
1350
1276
let sub_span = self . span . span_for_last_ident ( path. span ) ;
1351
- let mod_id = match self . lookup_def_id ( id) {
1352
- Some ( def_id) => {
1353
- self . process_def_kind ( id, path. span , sub_span, def_id) ;
1354
- Some ( def_id)
1355
- }
1356
- None => None ,
1357
- } ;
1358
-
1359
- // 'use' always introduces an alias, if there is not an explicit
1360
- // one, there is an implicit one.
1361
- let sub_span = match self . span . sub_span_after_keyword ( use_tree. span ,
1362
- keywords:: As ) {
1363
- Some ( sub_span) => Some ( sub_span) ,
1364
- None => sub_span,
1365
- } ;
1277
+ let alias_span = self . span . sub_span_after_keyword ( use_tree. span , keywords:: As ) ;
1278
+ let ref_id = self . lookup_def_id ( id) ;
1366
1279
1367
1280
if !self . span . filter_generated ( sub_span, path. span ) {
1368
- let span =
1369
- self . span_from_span ( sub_span . expect ( "No span found for use" ) ) ;
1281
+ let span = self . span_from_span ( sub_span . expect ( "No span found for use" ) ) ;
1282
+ let alias_span = alias_span . map ( |sp| self . span_from_span ( sp ) ) ;
1370
1283
self . dumper . import ( & access, Import {
1371
1284
kind : ImportKind :: Use ,
1372
- ref_id : mod_id . map ( |id| :: id_from_def_id ( id) ) ,
1285
+ ref_id : ref_id . map ( |id| :: id_from_def_id ( id) ) ,
1373
1286
span,
1287
+ alias_span,
1374
1288
name : ident. to_string ( ) ,
1375
1289
value : String :: new ( ) ,
1376
1290
parent,
@@ -1407,6 +1321,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
1407
1321
kind : ImportKind :: GlobUse ,
1408
1322
ref_id : None ,
1409
1323
span,
1324
+ alias_span : None ,
1410
1325
name : "*" . to_owned ( ) ,
1411
1326
value : names. join ( ", " ) ,
1412
1327
parent,
@@ -1500,6 +1415,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc
1500
1415
kind : ImportKind :: ExternCrate ,
1501
1416
ref_id : None ,
1502
1417
span,
1418
+ alias_span : None ,
1503
1419
name : item. ident . to_string ( ) ,
1504
1420
value : String :: new ( ) ,
1505
1421
parent,
0 commit comments