@@ -37,18 +37,23 @@ use self::syntax::ast;
37
37
use self :: syntax:: attr:: AttrMetaMethods ;
38
38
use self :: syntax:: codemap:: Span ;
39
39
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 > {
41
43
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
44
49
}
45
50
46
51
///////////////////////////////////////////////////////////////////////////
47
52
// OuterDump -- walks a crate, looking for fn items and methods to build MIR from
48
53
49
54
struct OuterDump < ' a , ' tcx : ' a > {
50
55
tcx : & ' a ty:: ctxt < ' tcx > ,
51
- map : & ' a mut NodeMap < Mir < ' tcx > > ,
56
+ map : & ' a mut MirMap < ' tcx > ,
52
57
}
53
58
54
59
impl < ' a , ' tcx > OuterDump < ' a , ' tcx > {
@@ -101,7 +106,7 @@ impl<'a, 'tcx> visit::Visitor<'tcx> for OuterDump<'a, 'tcx> {
101
106
102
107
struct InnerDump < ' a , ' m , ' tcx : ' a +' m > {
103
108
tcx : & ' a ty:: ctxt < ' tcx > ,
104
- map : & ' m mut NodeMap < Mir < ' tcx > > ,
109
+ map : & ' m mut MirMap < ' tcx > ,
105
110
attr : Option < & ' a ast:: Attribute > ,
106
111
}
107
112
0 commit comments