@@ -39,6 +39,7 @@ use rustc_serialize::{Decodable, Decoder, SpecializedDecoder, opaque};
39
39
use syntax:: attr;
40
40
use syntax:: ast;
41
41
use syntax:: codemap;
42
+ use syntax:: ext:: base:: MacroKind ;
42
43
use syntax_pos:: { self , Span , BytePos , Pos , DUMMY_SP } ;
43
44
44
45
pub struct DecodeContext < ' a , ' tcx : ' a > {
@@ -434,7 +435,7 @@ impl<'tcx> EntryKind<'tcx> {
434
435
EntryKind :: Variant ( _) => Def :: Variant ( did) ,
435
436
EntryKind :: Trait ( _) => Def :: Trait ( did) ,
436
437
EntryKind :: Enum ( ..) => Def :: Enum ( did) ,
437
- EntryKind :: MacroDef ( _) => Def :: Macro ( did) ,
438
+ EntryKind :: MacroDef ( _) => Def :: Macro ( did, MacroKind :: Bang ) ,
438
439
439
440
EntryKind :: ForeignMod |
440
441
EntryKind :: Impl ( _) |
@@ -483,9 +484,11 @@ impl<'a, 'tcx> CrateMetadata {
483
484
}
484
485
485
486
pub fn get_def ( & self , index : DefIndex ) -> Option < Def > {
486
- match self . is_proc_macro ( index) {
487
- true => Some ( Def :: Macro ( self . local_def_id ( index) ) ) ,
488
- false => self . entry ( index) . kind . to_def ( self . local_def_id ( index) ) ,
487
+ if !self . is_proc_macro ( index) {
488
+ self . entry ( index) . kind . to_def ( self . local_def_id ( index) )
489
+ } else {
490
+ let kind = self . proc_macros . as_ref ( ) . unwrap ( ) [ index. as_usize ( ) - 1 ] . 1 . kind ( ) ;
491
+ Some ( Def :: Macro ( self . local_def_id ( index) , kind) )
489
492
}
490
493
}
491
494
@@ -688,8 +691,14 @@ impl<'a, 'tcx> CrateMetadata {
688
691
{
689
692
if let Some ( ref proc_macros) = self . proc_macros {
690
693
if id == CRATE_DEF_INDEX {
691
- for ( id, & ( name, _) ) in proc_macros. iter ( ) . enumerate ( ) {
692
- let def = Def :: Macro ( DefId { krate : self . cnum , index : DefIndex :: new ( id + 1 ) } ) ;
694
+ for ( id, & ( name, ref ext) ) in proc_macros. iter ( ) . enumerate ( ) {
695
+ let def = Def :: Macro (
696
+ DefId {
697
+ krate : self . cnum ,
698
+ index : DefIndex :: new ( id + 1 )
699
+ } ,
700
+ ext. kind ( )
701
+ ) ;
693
702
callback ( def:: Export { name : name, def : def } ) ;
694
703
}
695
704
}
0 commit comments