@@ -61,9 +61,7 @@ tag scope {
61
61
type scopes = list < scope > ;
62
62
63
63
tag import_state {
64
- todo( @ast : : view_item, scopes) ; // only used for explicit imports
65
- todo_from( @ast : : view_item, ast : : import_ident, scopes) ;
66
-
64
+ todo( ast:: node_id, ast:: ident, [ ast:: ident] , codemap:: span, scopes) ;
67
65
resolving ( span) ;
68
66
resolved ( option:: t<def>,
69
67
/* value */
@@ -173,13 +171,15 @@ fn map_crate(e: &@env, c: &@ast::crate) {
173
171
glob_imported_names: new_str_hash :: < import_state > ( ) } ) ;
174
172
fn index_vi ( e : @env , i : & @ast:: view_item , sc : & scopes , v : & vt < scopes > ) {
175
173
alt i. node {
176
- ast:: view_item_import ( _ , ids, id) {
177
- e. imports . insert ( id, todo ( i , sc) ) ;
174
+ ast:: view_item_import ( name , ids, id) {
175
+ e. imports . insert ( id, todo ( id , name , ids , i . span , sc) ) ;
178
176
}
179
177
ast:: view_item_import_from ( mod_path, idents, id) {
180
178
for ident in idents {
181
179
e. imports . insert ( ident. node . id ,
182
- todo_from ( i, ident, sc) ) ;
180
+ todo ( ident. node . id , ident. node . name ,
181
+ mod_path + ~[ ident. node . name ] ,
182
+ ident. span , sc) ) ;
183
183
}
184
184
}
185
185
_ { }
@@ -251,23 +251,9 @@ fn resolve_imports(e: &env) {
251
251
for each it: @{ key : ast:: node_id, val : import_state} in e. imports . items ( )
252
252
{
253
253
alt it. val {
254
- todo ( item, sc) {
255
- alt item. node {
256
- ast:: view_item_import ( name, ids, id) {
257
- resolve_import ( e, local_def ( id) ,
258
- name, ids, item. span , sc) ;
259
- }
260
- }
261
- }
262
- todo_from ( item, ident, sc) {
263
- alt item. node {
264
- ast:: view_item_import_from ( mod_path, idents, _) {
265
- resolve_import ( e, local_def ( ident. node . id ) ,
266
- ident. node . name ,
267
- mod_path + ~[ ident. node . name ] ,
268
- ident. span , sc) ;
269
- }
270
- }
254
+ todo ( node_id, name, path, span, scopes) {
255
+ resolve_import ( e, local_def ( node_id) ,
256
+ name, path, span, scopes) ;
271
257
}
272
258
resolved ( _, _, _) { }
273
259
}
@@ -947,24 +933,9 @@ fn found_view_item(e: &env, vi: @ast::view_item, ns: namespace) ->
947
933
948
934
fn lookup_import ( e : & env , defid : def_id , ns : namespace ) -> option:: t < def > {
949
935
alt e. imports . get ( defid. node ) {
950
- todo ( item, sc) {
951
- alt item. node {
952
- ast:: view_item_import ( name, ids, id) {
953
- resolve_import ( e, local_def ( id) ,
954
- name, ids, item. span , sc) ;
955
- }
956
- }
957
- ret lookup_import ( e, defid, ns) ;
958
- }
959
- todo_from ( item, ident, sc) {
960
- alt item. node {
961
- ast:: view_item_import_from ( mod_path, idents, _) {
962
- resolve_import ( e, local_def ( ident. node . id ) ,
963
- ident. node . name ,
964
- mod_path + ~[ ident. node . name ] ,
965
- ident. span , sc) ;
966
- }
967
- }
936
+ todo ( node_id, name, path, span, scopes) {
937
+ resolve_import ( e, local_def ( node_id) ,
938
+ name, path, span, scopes) ;
968
939
ret lookup_import ( e, defid, ns) ;
969
940
}
970
941
resolving ( sp) { e. sess . span_err ( sp, "cyclic import" ) ; ret none; }
@@ -1051,7 +1022,7 @@ fn lookup_glob_in_mod(e: &env, info: @indexed_mod, sp: &span, id: &ident,
1051
1022
info. glob_imported_names . insert ( id, resolved ( val, typ, md) ) ;
1052
1023
}
1053
1024
alt info. glob_imported_names . get ( id) {
1054
- todo( _, _) { e. sess . bug ( "Shouldn't've put a todo in." ) ; }
1025
+ todo( _, _, _ , _ , _ ) { e. sess . bug ( "Shouldn't've put a todo in." ) ; }
1055
1026
resolving( sp) {
1056
1027
ret none :: < def > ; //circularity is okay in import globs
1057
1028
0 commit comments