@@ -116,7 +116,7 @@ type env =
116
116
rec ( crate_map crate_map,
117
117
def_map def_map,
118
118
constr_table fn_constrs,
119
- hashmap [ ast :: node_id , @ast :: item ] ast_map ,
119
+ ast_map :: map ast_map ,
120
120
hashmap[ ast:: node_id, import_state] imports ,
121
121
hashmap[ ast:: node_id, @indexed_mod] mod_map ,
122
122
hashmap[ def_id, vec[ ident] ] ext_map ,
@@ -130,13 +130,13 @@ tag dir { inside; outside; }
130
130
131
131
tag namespace { ns_value; ns_type; ns_module; }
132
132
133
- fn resolve_crate ( session sess, @ast:: crate crate) ->
133
+ fn resolve_crate ( session sess, & ast_map :: map amap , @ast:: crate crate) ->
134
134
tup ( def_map , constr_table ) {
135
135
auto e =
136
136
@rec ( crate_map=new_int_hash[ ast:: crate_num] ( ) ,
137
137
def_map=new_int_hash[ def] ( ) ,
138
138
fn_constrs = new_int_hash[ vec[ ty:: constr_def] ] ( ) ,
139
- ast_map=new_int_hash [ @ast :: item ] ( ) ,
139
+ ast_map=amap ,
140
140
imports=new_int_hash[ import_state] ( ) ,
141
141
mod_map=new_int_hash[ @indexed_mod] ( ) ,
142
142
ext_map=new_def_hash[ vec[ ident] ] ( ) ,
@@ -187,7 +187,6 @@ fn map_crate(&@env e, &@ast::crate c) {
187
187
index=index_mod ( md) ,
188
188
mutable glob_imports=vec:: empty[ def] ( ) ,
189
189
glob_imported_names=s) ) ;
190
- e. ast_map . insert ( i. id , i) ;
191
190
}
192
191
case ( ast:: item_native_mod ( ?nmd) ) {
193
192
auto s = new_str_hash[ import_state] ( ) ;
@@ -196,13 +195,8 @@ fn map_crate(&@env e, &@ast::crate c) {
196
195
index=index_nmod ( nmd) ,
197
196
mutable glob_imports=vec:: empty[ def] ( ) ,
198
197
glob_imported_names=s) ) ;
199
- e. ast_map . insert ( i. id , i) ;
200
198
}
201
- case ( ast:: item_obj ( _, _, ?ctor_id) ) {
202
- e. ast_map . insert ( i. id , i) ;
203
- e. ast_map . insert ( ctor_id, i) ;
204
- }
205
- case ( _) { e. ast_map . insert ( i. id , i) ; }
199
+ case ( _) { }
206
200
}
207
201
}
208
202
// Next, assemble the links for globbed imports.
@@ -969,16 +963,12 @@ fn lookup_glob_in_mod(&env e, @indexed_mod info, &span sp, &ident id,
969
963
ret some[ def] ( matches. ( 0 ) ) ;
970
964
} else {
971
965
for ( def match in matches) {
972
- alt ( e. ast_map. find( ast:: def_id_of_def( match) . _1) ) {
973
- case ( some( ?it) ) {
974
- e. sess. span_note( it. span,
975
- "'" + id + "' is defined here." ) ;
976
- }
977
- case ( _) {
978
- e. sess. bug( "Internal error: imports and matches " +
979
- "don't agree" ) ;
980
- }
981
- }
966
+ auto span = alt ( e. ast_map. get( ast:: def_id_of_def( match) . _1) ) {
967
+ case ( ast_map:: node_item( ?it) ) { it. span }
968
+ case ( ast_map:: node_obj_ctor( ?it) ) { it. span }
969
+ case ( ast_map:: node_native_item( ?it) ) { it. span }
970
+ } ;
971
+ e. sess. span_note( span, "'" + id + "' is defined here." ) ;
982
972
}
983
973
e. sess. span_fatal( sp,
984
974
"'" + id + "' is glob-imported from" +
0 commit comments