@@ -39,6 +39,7 @@ use rustc_serialize::{Decodable, Decoder, SpecializedDecoder, opaque};
3939use syntax:: attr;
4040use syntax:: ast;
4141use syntax:: codemap;
42+ use syntax:: ext:: base:: MacroKind ;
4243use syntax_pos:: { self , Span , BytePos , Pos , DUMMY_SP } ;
4344
4445pub struct DecodeContext < ' a , ' tcx : ' a > {
@@ -434,7 +435,7 @@ impl<'tcx> EntryKind<'tcx> {
434435 EntryKind :: Variant ( _) => Def :: Variant ( did) ,
435436 EntryKind :: Trait ( _) => Def :: Trait ( did) ,
436437 EntryKind :: Enum ( ..) => Def :: Enum ( did) ,
437- EntryKind :: MacroDef ( _) => Def :: Macro ( did) ,
438+ EntryKind :: MacroDef ( _) => Def :: Macro ( did, MacroKind :: Bang ) ,
438439
439440 EntryKind :: ForeignMod |
440441 EntryKind :: Impl ( _) |
@@ -483,9 +484,11 @@ impl<'a, 'tcx> CrateMetadata {
483484 }
484485
485486 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) )
489492 }
490493 }
491494
@@ -688,8 +691,14 @@ impl<'a, 'tcx> CrateMetadata {
688691 {
689692 if let Some ( ref proc_macros) = self . proc_macros {
690693 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+ ) ;
693702 callback ( def:: Export { name : name, def : def } ) ;
694703 }
695704 }
0 commit comments