@@ -206,13 +206,10 @@ fn map_crate(&@env e, &@ast::crate c) {
206
206
alt ( sc) {
207
207
case ( cons ( scope_item ( ?i) , ?tl) ) {
208
208
alt ( i. node ) {
209
- case ( ast:: item_mod ( _) ) {
209
+ ast:: item_mod ( _) | ast :: item_native_mod ( _ ) {
210
210
ret e. mod_map . get ( i. id ) ;
211
211
}
212
- case ( ast:: item_native_mod ( _) ) {
213
- ret e. mod_map . get ( i. id ) ;
214
- }
215
- case ( _) { be find_mod ( e, * tl) ; }
212
+ _ { be find_mod( e, * tl) ; }
216
213
}
217
214
}
218
215
case ( _) {
@@ -222,9 +219,8 @@ fn map_crate(&@env e, &@ast::crate c) {
222
219
}
223
220
}
224
221
alt ( vi. node ) {
225
- case (
226
- //if it really is a glob import, that is
227
- ast:: view_item_import_glob ( ?path, _) ) {
222
+ //if it really is a glob import, that is
223
+ case ( ast:: view_item_import_glob ( ?path, _) ) {
228
224
auto imp = follow_import ( * e, sc, path, vi. span ) ;
229
225
if ( option:: is_some ( imp) ) {
230
226
find_mod ( e, sc) . glob_imports +=
@@ -363,14 +359,11 @@ fn visit_arm_with_scope(&ast::arm a, &scopes sc, &vt[scopes] v) {
363
359
fn visit_expr_with_scope( & @ast:: expr x, & scopes sc, & vt[ scopes] v) {
364
360
auto new_sc =
365
361
alt ( x. node) {
366
- case ( ast:: expr_for( ?d, _, _) ) {
367
- cons[ scope] ( scope_loop( d) , @sc)
368
- }
369
- case ( ast:: expr_for_each( ?d, _, _) ) {
362
+ ast:: expr_for( ?d, _, _) | ast:: expr_for_each( ?d, _, _) {
370
363
cons[ scope] ( scope_loop( d) , @sc)
371
364
}
372
- case ( ast:: expr_fn( ?f) ) { cons( scope_fn( f. decl, ~[ ] ) , @sc) }
373
- case ( _ ) { sc }
365
+ ast:: expr_fn( ?f) { cons( scope_fn( f. decl, ~[ ] ) , @sc) }
366
+ _ { sc }
374
367
} ;
375
368
visit:: visit_expr( x, new_sc, v) ;
376
369
}
@@ -388,9 +381,8 @@ fn follow_import(&env e, &scopes sc, &ident[] path, &span sp)
388
381
}
389
382
if ( i == path_len) {
390
383
alt ( option:: get( dcur) ) {
391
- case ( ast:: def_mod( ?def_id) ) { ret dcur; }
392
- case ( ast:: def_native_mod( ?def_id) ) { ret dcur; }
393
- case ( _) {
384
+ ast:: def_mod( _) | ast:: def_native_mod( _) { ret dcur; }
385
+ _ {
394
386
e. sess. span_err( sp, str:: connect_ivec( path, "::" ) +
395
387
" does not name a module." ) ;
396
388
ret none;
@@ -579,19 +571,16 @@ fn lookup_in_scope_strict(&env e, scopes sc, &span sp, &ident name,
579
571
580
572
fn scope_is_fn ( & scope sc) -> bool {
581
573
ret alt ( sc) {
582
- case ( scope_fn( _, _) ) { true }
583
- case ( scope_native_item( _) ) { true }
584
- case ( _) { false }
574
+ scope_fn ( _, _) | scope_native_item ( _) { true }
575
+ _ { false }
585
576
} ;
586
577
}
587
578
588
579
fn def_is_local ( & def d) -> bool {
589
580
ret alt ( d) {
590
- case ( ast:: def_arg( _) ) { true }
591
- case ( ast:: def_local( _) ) { true }
592
- case ( ast:: def_binding( _) ) { true }
593
- case ( _) { false }
594
- } ;
581
+ ast:: def_arg ( _) | ast:: def_local ( _) | ast:: def_binding ( _) { true }
582
+ _ { false }
583
+ } ;
595
584
}
596
585
597
586
fn def_is_obj_field ( & def d) -> bool {
@@ -1092,25 +1081,12 @@ fn index_mod(&ast::_mod md) -> mod_index {
1092
1081
}
1093
1082
for ( @ast:: item it in md. items) {
1094
1083
alt ( it. node) {
1095
- case ( ast:: item_const( _, _) ) {
1096
- add_to_index( index, it. ident, mie_item( it) ) ;
1097
- }
1098
- case ( ast:: item_fn( _, _) ) {
1099
- add_to_index( index, it. ident, mie_item( it) ) ;
1100
- }
1101
- case ( ast:: item_mod( _) ) {
1102
- add_to_index( index, it. ident, mie_item( it) ) ;
1103
- }
1104
- case ( ast:: item_native_mod( _) ) {
1105
- add_to_index( index, it. ident, mie_item( it) ) ;
1106
- }
1107
- case ( ast:: item_ty( _, _) ) {
1108
- add_to_index( index, it. ident, mie_item( it) ) ;
1109
- }
1110
- case ( ast:: item_res( _, _, _, _) ) {
1084
+ ast:: item_const( _, _) | ast:: item_fn( _, _) | ast:: item_mod( _) |
1085
+ ast:: item_native_mod( _) | ast:: item_ty( _, _) |
1086
+ ast:: item_res( _, _, _, _) | ast:: item_obj( _, _, _) {
1111
1087
add_to_index( index, it. ident, mie_item( it) ) ;
1112
1088
}
1113
- case ( ast:: item_tag( ?variants, _) ) {
1089
+ ast:: item_tag( ?variants, _) {
1114
1090
add_to_index( index, it. ident, mie_item( it) ) ;
1115
1091
let uint variant_idx = 0 u;
1116
1092
for ( ast:: variant v in variants) {
@@ -1119,9 +1095,6 @@ fn index_mod(&ast::_mod md) -> mod_index {
1119
1095
variant_idx += 1 u;
1120
1096
}
1121
1097
}
1122
- case ( ast:: item_obj( _, _, _) ) {
1123
- add_to_index( index, it. ident, mie_item( it) ) ;
1124
- }
1125
1098
}
1126
1099
}
1127
1100
ret index;
@@ -1228,12 +1201,12 @@ fn check_mod_name(&env e, &ident name, list[mod_index_entry] entries) {
1228
1201
}
1229
1202
1230
1203
fn mie_span ( & mod_index_entry mie) -> span {
1231
- alt ( mie) {
1232
- case ( mie_view_item( ?item) ) { ret item. span; }
1233
- case ( mie_item( ?item) ) { ret item. span; }
1234
- case ( mie_tag_variant( ?item, _) ) { ret item. span; }
1235
- case ( mie_native_item( ?item) ) { ret item. span; }
1236
- }
1204
+ ret alt ( mie) {
1205
+ mie_view_item ( ?item) { item. span }
1206
+ mie_item ( ?item) { item. span }
1207
+ mie_tag_variant ( ?item, _) { item. span }
1208
+ mie_native_item ( ?item) { item. span }
1209
+ } ;
1237
1210
}
1238
1211
1239
1212
fn check_item ( @env e , & @ast:: item i, & ( ) x, & vt[ ( ) ] v) {
@@ -1313,41 +1286,32 @@ fn check_block(@env e, &ast::block b, &() x, &vt[()] v) {
1313
1286
alt ( st. node ) {
1314
1287
case ( ast:: stmt_decl ( ?d, _) ) {
1315
1288
alt ( d. node ) {
1316
- case ( ast:: decl_local( ?loc) ) {
1289
+ ast:: decl_local ( ?loc) {
1317
1290
add_name ( values, d. span , loc. node . ident ) ;
1318
1291
}
1319
- case ( ast:: decl_item( ?it) ) {
1292
+ ast:: decl_item ( ?it) {
1320
1293
alt ( it. node ) {
1321
- case ( ast:: item_tag( ?variants, _) ) {
1294
+ ast:: item_tag ( ?variants, _) {
1322
1295
add_name ( types, it. span , it. ident ) ;
1323
1296
for ( ast:: variant v in variants) {
1324
1297
add_name ( values, v. span , v. node . name ) ;
1325
1298
}
1326
1299
}
1327
- case ( ast:: item_const( _, _) ) {
1328
- add_name( values, it. span, it. ident) ;
1329
- }
1330
- case ( ast:: item_fn( _, _) ) {
1331
- add_name( values, it. span, it. ident) ;
1332
- }
1333
- case ( ast:: item_mod( _) ) {
1334
- add_name( mods, it. span, it. ident) ;
1335
- }
1336
- case ( ast:: item_native_mod( _) ) {
1300
+ ast:: item_mod ( _) | ast:: item_native_mod ( _) {
1337
1301
add_name ( mods, it. span , it. ident ) ;
1338
1302
}
1339
- case ( ast:: item_ty ( _, _) ) {
1340
- add_name( types , it. span, it. ident) ;
1303
+ ast:: item_const ( _, _) | ast :: item_fn ( _ , _ ) {
1304
+ add_name ( values , it. span , it. ident ) ;
1341
1305
}
1342
- case ( ast:: item_res ( _, _, _ , _ ) ) {
1306
+ ast:: item_ty ( _, _) {
1343
1307
add_name ( types, it. span , it. ident ) ;
1344
- add_name( values, it. span, it. ident) ;
1345
1308
}
1346
- case ( ast:: item_obj( _, _, _) ) {
1309
+ ast:: item_res ( _, _, _, _) |
1310
+ ast:: item_obj ( _, _, _) {
1347
1311
add_name ( types, it. span , it. ident ) ;
1348
1312
add_name ( values, it. span , it. ident ) ;
1349
1313
}
1350
- case ( _ ) { }
1314
+ _ { }
1351
1315
}
1352
1316
}
1353
1317
}
0 commit comments