@@ -273,6 +273,7 @@ type ast_fold[ENV] =
273
273
( fn ( & ENV e, & ast. native_mod m) -> ast. native_mod ) fold_native_mod,
274
274
275
275
( fn ( & ENV e, & span sp,
276
+ vec[ @ast. crate_directive ] cdirs,
276
277
& ast. _mod m) -> @ast. crate ) fold_crate,
277
278
278
279
( fn ( & ENV e,
@@ -991,9 +992,12 @@ fn fold_native_mod[ENV](&ENV e, ast_fold[ENV] fld,
991
992
}
992
993
993
994
fn fold_crate[ ENV ] ( & ENV env, ast_fold[ ENV ] fld, @ast. crate c) -> @ast. crate {
995
+ // FIXME: possibly fold the directives so you process any expressions
996
+ // within them? Not clear. After front/eval.rs, nothing else should look
997
+ // at crate directives.
994
998
let ENV env_ = fld. update_env_for_crate( env, c) ;
995
999
let ast. _mod m = fold_mod[ ENV ] ( env_, fld, c. node. module) ;
996
- ret fld. fold_crate( env_, c. span, m) ;
1000
+ ret fld. fold_crate( env_, c. span, c . node . directives , m) ;
997
1001
}
998
1002
999
1003
//// Identity folds.
@@ -1381,8 +1385,10 @@ fn identity_fold_native_mod[ENV](&ENV e,
1381
1385
ret m;
1382
1386
}
1383
1387
1384
- fn identity_fold_crate[ ENV ] ( & ENV e, & span sp, & ast. _mod m) -> @ast. crate {
1385
- ret @respan( sp, rec( module=m) ) ;
1388
+ fn identity_fold_crate[ ENV ] ( & ENV e, & span sp,
1389
+ vec[ @ast. crate_directive] cdirs,
1390
+ & ast. _mod m) -> @ast. crate {
1391
+ ret @respan( sp, rec( directives=cdirs, module=m) ) ;
1386
1392
}
1387
1393
1388
1394
fn identity_fold_obj[ ENV ] ( & ENV e,
@@ -1537,7 +1543,7 @@ fn new_identity_fold[ENV]() -> ast_fold[ENV] {
1537
1543
fold_fn_decl = bind identity_fold_fn_decl[ ENV ] ( _, _, _, _) ,
1538
1544
fold_mod = bind identity_fold_mod[ ENV ] ( _, _) ,
1539
1545
fold_native_mod = bind identity_fold_native_mod[ ENV ] ( _, _) ,
1540
- fold_crate = bind identity_fold_crate[ ENV ] ( _, _, _) ,
1546
+ fold_crate = bind identity_fold_crate[ ENV ] ( _, _, _, _ ) ,
1541
1547
fold_obj = bind identity_fold_obj[ ENV ] ( _, _, _, _) ,
1542
1548
1543
1549
update_env_for_crate = bind identity_update_env_for_crate[ ENV ] ( _, _) ,
0 commit comments