@@ -37,18 +37,23 @@ use self::syntax::ast;
3737use self :: syntax:: attr:: AttrMetaMethods ;
3838use self :: syntax:: codemap:: Span ;
3939
40- pub fn dump_crate ( tcx : & ty:: ctxt ) {
40+ pub type MirMap < ' tcx > = NodeMap < Mir < ' tcx > > ;
41+
42+ pub fn dump_crate < ' tcx > ( tcx : & ty:: ctxt < ' tcx > ) -> MirMap < ' tcx > {
4143 let mut map = NodeMap ( ) ;
42- let mut dump = OuterDump { tcx : tcx, map : & mut map } ;
43- visit:: walk_crate ( & mut dump, tcx. map . krate ( ) ) ;
44+ {
45+ let mut dump = OuterDump { tcx : tcx, map : & mut map } ;
46+ visit:: walk_crate ( & mut dump, tcx. map . krate ( ) ) ;
47+ }
48+ map
4449}
4550
4651///////////////////////////////////////////////////////////////////////////
4752// OuterDump -- walks a crate, looking for fn items and methods to build MIR from
4853
4954struct OuterDump < ' a , ' tcx : ' a > {
5055 tcx : & ' a ty:: ctxt < ' tcx > ,
51- map : & ' a mut NodeMap < Mir < ' tcx > > ,
56+ map : & ' a mut MirMap < ' tcx > ,
5257}
5358
5459impl < ' a , ' tcx > OuterDump < ' a , ' tcx > {
@@ -101,7 +106,7 @@ impl<'a, 'tcx> visit::Visitor<'tcx> for OuterDump<'a, 'tcx> {
101106
102107struct InnerDump < ' a , ' m , ' tcx : ' a +' m > {
103108 tcx : & ' a ty:: ctxt < ' tcx > ,
104- map : & ' m mut NodeMap < Mir < ' tcx > > ,
109+ map : & ' m mut MirMap < ' tcx > ,
105110 attr : Option < & ' a ast:: Attribute > ,
106111}
107112
0 commit comments