@@ -37,7 +37,7 @@ export expr_ty_params_and_ty;
37
37
export expr_is_lval;
38
38
export field_ty;
39
39
export fold_ty, fold_sty_to_ty, fold_region, fold_regions, fold_ty_var;
40
- export fold_regions_and_ty;
40
+ export fold_regions_and_ty, walk_regions_and_ty ;
41
41
export field;
42
42
export field_idx;
43
43
export get_field;
@@ -97,7 +97,7 @@ export ty_tup, mk_tup;
97
97
export ty_type, mk_type;
98
98
export ty_uint, mk_uint, mk_mach_uint;
99
99
export ty_uniq, mk_uniq, mk_imm_uniq, type_is_unique_box;
100
- export ty_var, mk_var;
100
+ export ty_var, mk_var, type_is_var ;
101
101
export ty_self, mk_self;
102
102
export region, bound_region;
103
103
export get, type_has_params, type_has_vars, type_has_regions;
@@ -818,6 +818,21 @@ fn fold_ty_var(cx: ctxt, t0: t, fldop: fn(ty_vid) -> t) -> t {
818
818
}
819
819
}
820
820
821
+ fn walk_regions_and_ty(
822
+ cx: ctxt,
823
+ ty: t,
824
+ walkr: fn ( r: region) ,
825
+ walkt: fn ( t: t) -> bool) {
826
+
827
+ if ( walkt( ty) ) {
828
+ fold_regions_and_ty(
829
+ cx, ty,
830
+ { |r| walkr( r) ; r } ,
831
+ { |t| walkt( t) ; walk_regions_and_ty( cx, t, walkr, walkt) ; t } ,
832
+ { |t| walkt( t) ; walk_regions_and_ty( cx, t, walkr, walkt) ; t } ) ;
833
+ }
834
+ }
835
+
821
836
fn fold_regions_and_ty(
822
837
cx: ctxt,
823
838
ty: t,
@@ -1000,6 +1015,13 @@ fn type_is_nil(ty: t) -> bool { get(ty).struct == ty_nil }
1000
1015
1001
1016
fn type_is_bot( ty: t) -> bool { get( ty) . struct == ty_bot }
1002
1017
1018
+ fn type_is_var( ty: t) -> bool {
1019
+ alt get( ty) . struct {
1020
+ ty_var( _) { true }
1021
+ _ { false }
1022
+ }
1023
+ }
1024
+
1003
1025
fn type_is_bool( ty: t) -> bool { get( ty) . struct == ty_bool }
1004
1026
1005
1027
fn type_is_structural( ty: t) -> bool {
0 commit comments