@@ -6,8 +6,8 @@ import syntax::ast_util;
6
6
import syntax:: ast_util:: path_to_ident;
7
7
import syntax:: ast_util:: inlined_item_methods;
8
8
import syntax:: { visit, codemap} ;
9
- import driver:: session:: session;
10
9
import syntax:: attr;
10
+ import syntax:: diagnostic:: span_handler;
11
11
12
12
enum path_elt { path_mod( str ) , path_name( str ) }
13
13
type path = [ path_elt ] ;
@@ -59,7 +59,7 @@ enum a_ctor {
59
59
60
60
type map = std:: map:: hashmap < node_id , ast_node > ;
61
61
type ctx = { map : map , mut path: path,
62
- mut local_id : uint , sess : session } ;
62
+ mut local_id : uint , diag : span_handler } ;
63
63
type vt = visit:: vt < ctx > ;
64
64
65
65
fn extend ( cx : ctx , elt : str ) -> @path {
@@ -79,19 +79,20 @@ fn mk_ast_map_visitor() -> vt {
79
79
} ) ;
80
80
}
81
81
82
- fn map_crate ( sess : session , c: crate ) -> map {
82
+ fn map_crate ( diag : span_handler , c: crate ) -> map {
83
83
let cx = { map: std:: map:: int_hash ( ) ,
84
84
mut path: [ ] ,
85
85
mut local_id: 0 u,
86
- sess : sess } ;
86
+ diag : diag } ;
87
87
visit:: visit_crate ( c, cx, mk_ast_map_visitor ( ) ) ;
88
88
ret cx. map ;
89
89
}
90
90
91
91
// Used for items loaded from external crate that are being inlined into this
92
92
// crate. The `path` should be the path to the item but should not include
93
93
// the item itself.
94
- fn map_decoded_item ( sess : session , map : map , path : path , ii : inlined_item ) {
94
+ fn map_decoded_item ( diag : span_handler ,
95
+ map : map , path : path , ii : inlined_item ) {
95
96
// I believe it is ok for the local IDs of inlined items from other crates
96
97
// to overlap with the local ids from this crate, so just generate the ids
97
98
// starting from 0. (In particular, I think these ids are only used in
@@ -101,7 +102,7 @@ fn map_decoded_item(sess: session, map: map, path: path, ii: inlined_item) {
101
102
let cx = { map: map,
102
103
mut path: path ,
103
104
mut local_id: 0 u ,
104
- sess : sess } ;
105
+ diag : diag } ;
105
106
let v = mk_ast_map_visitor ( ) ;
106
107
107
108
// methods get added to the AST map when their impl is visited. Since we
@@ -205,7 +206,7 @@ fn map_item(i: @item, cx: ctx, v: vt) {
205
206
}
206
207
item_native_mod ( nm) {
207
208
let abi = alt attr:: native_abi ( i. attrs ) {
208
- either:: left ( msg) { cx. sess . span_fatal ( i. span , msg) ; }
209
+ either:: left ( msg) { cx. diag . span_fatal ( i. span , msg) ; }
209
210
either:: right ( abi) { abi }
210
211
} ;
211
212
for nm. items. each { |nitem|
0 commit comments