1
-
2
1
import std:: int;
3
2
import std:: ivec;
4
3
import std:: str;
@@ -360,27 +359,27 @@ type node_type_table =
360
359
@smallintmap:: smallintmap [ ty:: ty_param_substs_opt_and_ty ] ;
361
360
362
361
fn populate_type_store ( & ctxt cx) {
363
- intern ( cx, ty_nil, none[ str ] ) ;
364
- intern ( cx, ty_bool, none[ str ] ) ;
365
- intern ( cx, ty_int, none[ str ] ) ;
366
- intern ( cx, ty_float, none[ str ] ) ;
367
- intern ( cx, ty_uint, none[ str ] ) ;
368
- intern ( cx, ty_machine ( ast:: ty_i8) , none[ str ] ) ;
369
- intern ( cx, ty_machine ( ast:: ty_i16) , none[ str ] ) ;
370
- intern ( cx, ty_machine ( ast:: ty_i32) , none[ str ] ) ;
371
- intern ( cx, ty_machine ( ast:: ty_i64) , none[ str ] ) ;
372
- intern ( cx, ty_machine ( ast:: ty_u8) , none[ str ] ) ;
373
- intern ( cx, ty_machine ( ast:: ty_u16) , none[ str ] ) ;
374
- intern ( cx, ty_machine ( ast:: ty_u32) , none[ str ] ) ;
375
- intern ( cx, ty_machine ( ast:: ty_u64) , none[ str ] ) ;
376
- intern ( cx, ty_machine ( ast:: ty_f32) , none[ str ] ) ;
377
- intern ( cx, ty_machine ( ast:: ty_f64) , none[ str ] ) ;
378
- intern ( cx, ty_char, none[ str ] ) ;
379
- intern ( cx, ty_str, none[ str ] ) ;
380
- intern ( cx, ty_istr, none[ str ] ) ;
381
- intern ( cx, ty_task, none[ str ] ) ;
382
- intern ( cx, ty_type, none[ str ] ) ;
383
- intern ( cx, ty_bot, none[ str ] ) ;
362
+ intern ( cx, ty_nil, none) ;
363
+ intern ( cx, ty_bool, none) ;
364
+ intern ( cx, ty_int, none) ;
365
+ intern ( cx, ty_float, none) ;
366
+ intern ( cx, ty_uint, none) ;
367
+ intern ( cx, ty_machine ( ast:: ty_i8) , none) ;
368
+ intern ( cx, ty_machine ( ast:: ty_i16) , none) ;
369
+ intern ( cx, ty_machine ( ast:: ty_i32) , none) ;
370
+ intern ( cx, ty_machine ( ast:: ty_i64) , none) ;
371
+ intern ( cx, ty_machine ( ast:: ty_u8) , none) ;
372
+ intern ( cx, ty_machine ( ast:: ty_u16) , none) ;
373
+ intern ( cx, ty_machine ( ast:: ty_u32) , none) ;
374
+ intern ( cx, ty_machine ( ast:: ty_u64) , none) ;
375
+ intern ( cx, ty_machine ( ast:: ty_f32) , none) ;
376
+ intern ( cx, ty_machine ( ast:: ty_f64) , none) ;
377
+ intern ( cx, ty_char, none) ;
378
+ intern ( cx, ty_str, none) ;
379
+ intern ( cx, ty_istr, none) ;
380
+ intern ( cx, ty_task, none) ;
381
+ intern ( cx, ty_type, none) ;
382
+ intern ( cx, ty_bot, none) ;
384
383
assert ( ivec:: len ( cx. ts . vect ) == idx_first_others) ;
385
384
}
386
385
@@ -530,7 +529,7 @@ fn gen_ty_full(&ctxt cx, &sty st, &option::t[str] cname) -> t {
530
529
531
530
// These are private constructors to this module. External users should always
532
531
// use the mk_foo() functions below.
533
- fn gen_ty ( & ctxt cx, & sty st) -> t { ret gen_ty_full ( cx, st, none[ str ] ) ; }
532
+ fn gen_ty ( & ctxt cx, & sty st) -> t { ret gen_ty_full ( cx, st, none) ; }
534
533
535
534
fn mk_nil ( & ctxt cx) -> t { ret idx_nil; }
536
535
@@ -859,7 +858,7 @@ fn fold_ty(&ctxt cx, fold_mode fld, t ty_0) -> t {
859
858
// Type utilities
860
859
861
860
fn rename( & ctxt cx, t typ, str new_cname) -> t {
862
- ret gen_ty_full( cx, struct( cx, typ) , some[ str ] ( new_cname) ) ;
861
+ ret gen_ty_full( cx, struct( cx, typ) , some( new_cname) ) ;
863
862
}
864
863
865
864
fn strip_cname( & ctxt cx, t typ) -> t {
@@ -1270,10 +1269,10 @@ fn type_owns_heap_mem(&ctxt cx, &t ty) -> bool {
1270
1269
1271
1270
fn type_param( & ctxt cx, & t ty) -> option:: t[ uint] {
1272
1271
alt ( struct ( cx, ty) ) {
1273
- case ( ty_param( ?id) ) { ret some[ uint ] ( id) ; }
1272
+ case ( ty_param( ?id) ) { ret some( id) ; }
1274
1273
case ( _) { /* fall through * / }
1275
1274
}
1276
- ret none[ uint ] ;
1275
+ ret none;
1277
1276
}
1278
1277
1279
1278
fn type_autoderef( & ctxt cx, & ty:: t t) -> ty:: t {
@@ -1737,7 +1736,7 @@ fn eq_raw_ty(&@raw_t a, &@raw_t b) -> bool {
1737
1736
alt ( a. cname) {
1738
1737
case ( none) {
1739
1738
alt ( b. cname) {
1740
- case ( none[ str ] ) { /* ok * / }
1739
+ case ( none) { /* ok */ }
1741
1740
case ( _) { ret false; }
1742
1741
}
1743
1742
}
@@ -2177,10 +2176,10 @@ mod unify {
2177
2176
// Unifies two mutability flags.
2178
2177
fn unify_mut( ast:: mutability expected, ast:: mutability actual) ->
2179
2178
option:: t[ ast:: mutability] {
2180
- if ( expected == actual) { ret some[ ast :: mutability ] ( expected) ; }
2181
- if ( expected == ast:: maybe_mut) { ret some[ ast :: mutability ] ( actual) ; }
2182
- if ( actual == ast:: maybe_mut) { ret some[ ast :: mutability ] ( expected) ; }
2183
- ret none[ ast :: mutability ] ;
2179
+ if ( expected == actual) { ret some( expected) ; }
2180
+ if ( expected == ast:: maybe_mut) { ret some( actual) ; }
2181
+ if ( actual == ast:: maybe_mut) { ret some( expected) ; }
2182
+ ret none;
2184
2183
}
2185
2184
tag fn_common_res {
2186
2185
fn_common_res_err( result) ;
@@ -2332,8 +2331,8 @@ mod unify {
2332
2331
}
2333
2332
auto root_id = ufindivec:: find( vb. sets, vid as uint) ;
2334
2333
alt ( smallintmap:: find[ t] ( vb. types, root_id) ) {
2335
- case ( none[ t ] ) { ret fix_err( vid) ; }
2336
- case ( some[ t ] ( ?rt) ) { ret fix_ok( rt) ; }
2334
+ case ( none) { ret fix_err( vid) ; }
2335
+ case ( some( ?rt) ) { ret fix_ok( rt) ; }
2337
2336
}
2338
2337
}
2339
2338
case ( _) { ret fix_ok( typ) ; }
@@ -2778,8 +2777,8 @@ mod unify {
2778
2777
}
2779
2778
auto typespec;
2780
2779
alt ( smallintmap:: find[ t] ( vb. types, i) ) {
2781
- case ( none[ t ] ) { typespec = ""; }
2782
- case ( some[ t ] ( ?typ) ) {
2780
+ case ( none) { typespec = ""; }
2781
+ case ( some( ?typ) ) {
2783
2782
typespec = " =" + ty_to_str( tcx, typ) ;
2784
2783
}
2785
2784
}
@@ -2793,16 +2792,16 @@ mod unify {
2793
2792
fn subst_vars( ty_ctxt tcx, @var_bindings vb,
2794
2793
@mutable option:: t[ int] unresolved, int vid) -> t {
2795
2794
if ( vid as uint >= ufindivec:: set_count( vb. sets) ) {
2796
- * unresolved = some[ int ] ( vid) ;
2795
+ * unresolved = some( vid) ;
2797
2796
ret ty:: mk_var( tcx, vid) ;
2798
2797
}
2799
2798
auto root_id = ufindivec:: find( vb. sets, vid as uint) ;
2800
2799
alt ( smallintmap:: find[ t] ( vb. types, root_id) ) {
2801
- case ( none[ t ] ) {
2802
- * unresolved = some[ int ] ( vid) ;
2800
+ case ( none) {
2801
+ * unresolved = some( vid) ;
2803
2802
ret ty:: mk_var( tcx, vid) ;
2804
2803
}
2805
- case ( some[ t ] ( ?rt) ) {
2804
+ case ( some( ?rt) ) {
2806
2805
ret fold_ty( tcx,
2807
2806
fm_var( bind subst_vars( tcx, vb, unresolved,
2808
2807
_) ) , rt) ;
@@ -2815,8 +2814,8 @@ mod unify {
2815
2814
typ) ;
2816
2815
auto ur = * unresolved;
2817
2816
alt ( ur) {
2818
- case ( none[ int ] ) { ret fix_ok( rty) ; }
2819
- case ( some[ int ] ( ?var_id) ) { ret fix_err( var_id) ; }
2817
+ case ( none) { ret fix_ok( rty) ; }
2818
+ case ( some( ?var_id) ) { ret fix_err( var_id) ; }
2820
2819
}
2821
2820
}
2822
2821
fn resolve_type_var( & ty_ctxt tcx, & @var_bindings vb, int vid) ->
@@ -2826,8 +2825,8 @@ mod unify {
2826
2825
}
2827
2826
auto root_id = ufindivec:: find( vb. sets, vid as uint) ;
2828
2827
alt ( smallintmap:: find[ t] ( vb. types, root_id) ) {
2829
- case ( none[ t ] ) { ret fix_err( vid) ; }
2830
- case ( some[ t ] ( ?rt) ) { ret fixup_vars( tcx, vb, rt) ; }
2828
+ case ( none) { ret fix_err( vid) ; }
2829
+ case ( some( ?rt) ) { ret fixup_vars( tcx, vb, rt) ; }
2831
2830
}
2832
2831
}
2833
2832
}
0 commit comments