@@ -6,6 +6,7 @@ import front.ast.ann;
6
6
import front. creader ;
7
7
import driver. session . session ;
8
8
import util. common . new_def_hash ;
9
+ import util. common . new_int_hash ;
9
10
import util. common . span ;
10
11
import util. typestate_ann . ts_ann ;
11
12
import std. Map . hashmap ;
@@ -56,8 +57,8 @@ fn new_ext_hash() -> ext_hash {
56
57
ret std. Map . mk_hashmap [ tup ( def_id, str) , def] ( hash, eq) ;
57
58
}
58
59
59
- type env = rec ( hashmap[ def_id , import_state] imports ,
60
- hashmap[ def_id , @wrap_mod] mod_map ,
60
+ type env = rec ( hashmap[ ast . def_num , import_state] imports ,
61
+ hashmap[ ast . def_num , @wrap_mod] mod_map ,
61
62
hashmap[ def_id, vec[ ident] ] ext_map ,
62
63
ext_hash ext_cache ,
63
64
session sess) ;
@@ -72,8 +73,8 @@ tag namespace {
72
73
}
73
74
74
75
fn resolve_crate ( session sess, @ast. crate crate) -> @ast. crate {
75
- auto e = @rec ( imports = new_def_hash [ import_state] ( ) ,
76
- mod_map = new_def_hash [ @wrap_mod] ( ) ,
76
+ auto e = @rec ( imports = new_int_hash [ import_state] ( ) ,
77
+ mod_map = new_int_hash [ @wrap_mod] ( ) ,
77
78
ext_map = new_def_hash[ vec[ ident] ] ( ) ,
78
79
ext_cache = new_ext_hash ( ) ,
79
80
sess = sess) ;
@@ -107,10 +108,10 @@ fn map_crate(&@env e, &ast.crate c) {
107
108
* sc = cons[ scope] ( scope_item ( i) , @* sc) ;
108
109
alt ( i. node ) {
109
110
case ( ast. item_mod ( _, ?md, ?defid) ) {
110
- e. mod_map . insert ( defid, @wmod ( md) ) ;
111
+ e. mod_map . insert ( defid. _1 , @wmod ( md) ) ;
111
112
}
112
113
case ( ast. item_native_mod ( _, ?nmd, ?defid) ) {
113
- e. mod_map . insert ( defid, @wnmod ( nmd) ) ;
114
+ e. mod_map . insert ( defid. _1 , @wnmod ( nmd) ) ;
114
115
}
115
116
case ( _) { }
116
117
}
@@ -121,15 +122,15 @@ fn map_crate(&@env e, &ast.crate c) {
121
122
fn visit_view_item ( @env e , @mutable list[ scope] sc , & @ast. view_item i ) {
122
123
alt ( i. node ) {
123
124
case ( ast. view_item_import ( _, ?ids, ?defid) ) {
124
- e. imports . insert ( defid, todo ( i, * sc) ) ;
125
+ e. imports . insert ( defid. _1 , todo ( i, * sc) ) ;
125
126
}
126
127
case ( _) { }
127
128
}
128
129
}
129
130
}
130
131
131
132
fn resolve_imports ( & env e) {
132
- for each ( @tup( def_id , import_state) it in e. imports . items ( ) ) {
133
+ for each ( @tup( ast . def_num , import_state) it in e. imports . items ( ) ) {
133
134
alt ( it. _1 ) {
134
135
case ( todo ( ?item, ?sc) ) {
135
136
resolve_import ( e, item, sc) ;
@@ -185,7 +186,7 @@ fn resolve_names(&@env e, &ast.crate c) -> @ast.crate {
185
186
}
186
187
187
188
fn lookup_import ( & env e, def_id defid, namespace ns) -> Option . t[ def ] {
188
- alt ( e. imports . get ( defid) ) {
189
+ alt ( e. imports . get ( defid. _1 ) ) {
189
190
case ( todo ( ?item, ?sc) ) {
190
191
resolve_import ( e, item, sc) ;
191
192
ret lookup_import ( e, defid, ns) ;
@@ -207,7 +208,7 @@ fn resolve_import(&env e, &@ast.view_item it, &list[scope] sc) {
207
208
defid = _defid; ids = _ids;
208
209
}
209
210
}
210
- e. imports . insert ( defid, resolving ( it. span ) ) ;
211
+ e. imports . insert ( defid. _1 , resolving ( it. span ) ) ;
211
212
212
213
auto n_idents = Vec . len ( ids) ;
213
214
auto end_id = ids. ( n_idents - 1 u) ;
@@ -242,7 +243,7 @@ fn resolve_import(&env e, &@ast.view_item it, &list[scope] sc) {
242
243
if ( val == none[ def] && typ == none[ def] ) {
243
244
unresolved ( e, sp, id, "import" ) ;
244
245
}
245
- e. imports . insert ( defid, resolved ( val, typ) ) ;
246
+ e. imports . insert ( defid. _1 , resolved ( val, typ) ) ;
246
247
}
247
248
}
248
249
@@ -610,14 +611,14 @@ fn lookup_in_mod(&env e, def m, ident id, namespace ns, dir dr)
610
611
}
611
612
alt ( m) {
612
613
case ( ast. def_mod ( ?defid) ) {
613
- alt ( * e. mod_map . get ( defid) ) {
614
+ alt ( * e. mod_map . get ( defid. _1 ) ) {
614
615
case ( wmod ( ?m) ) {
615
616
ret lookup_in_regular_mod ( e, m, id, ns, dr) ;
616
617
}
617
618
}
618
619
}
619
620
case ( ast. def_native_mod ( ?defid) ) {
620
- alt ( * e. mod_map . get ( defid) ) {
621
+ alt ( * e. mod_map . get ( defid. _1 ) ) {
621
622
case ( wnmod ( ?m) ) {
622
623
ret lookup_in_native_mod ( e, m, id, ns) ;
623
624
}
0 commit comments