@@ -183,23 +183,23 @@ use syntax::codemap::{span, dummy_sp};
183
183
184
184
// An option identifying a literal: either a unit-like struct or an
185
185
// expression.
186
- pub enum Lit {
186
+ enum Lit {
187
187
UnitLikeStructLit ( ast:: NodeId ) , // the node ID of the pattern
188
188
ExprLit ( @ast:: expr ) ,
189
189
ConstLit ( ast:: def_id ) , // the def ID of the constant
190
190
}
191
191
192
192
// An option identifying a branch (either a literal, a enum variant or a
193
193
// range)
194
- pub enum Opt {
194
+ enum Opt {
195
195
lit( Lit ) ,
196
196
var( /* disr val */ uint , @adt:: Repr ) ,
197
197
range( @ast:: expr , @ast:: expr ) ,
198
198
vec_len_eq( uint ) ,
199
199
vec_len_ge( uint , /* slice */ uint )
200
200
}
201
201
202
- pub fn opt_eq ( tcx : ty:: ctxt , a : & Opt , b : & Opt ) -> bool {
202
+ fn opt_eq ( tcx : ty:: ctxt , a : & Opt , b : & Opt ) -> bool {
203
203
match ( a, b) {
204
204
( & lit( a) , & lit( b) ) => {
205
205
match ( a, b) {
@@ -258,7 +258,7 @@ pub enum opt_result {
258
258
lower_bound( Result ) ,
259
259
range_result( Result , Result ) ,
260
260
}
261
- pub fn trans_opt ( bcx : @mut Block , o : & Opt ) -> opt_result {
261
+ fn trans_opt ( bcx : @mut Block , o : & Opt ) -> opt_result {
262
262
let _icx = push_ctxt ( "match::trans_opt" ) ;
263
263
let ccx = bcx. ccx ( ) ;
264
264
let bcx = bcx;
@@ -292,7 +292,7 @@ pub fn trans_opt(bcx: @mut Block, o: &Opt) -> opt_result {
292
292
}
293
293
}
294
294
295
- pub fn variant_opt ( bcx : @mut Block , pat_id : ast:: NodeId )
295
+ fn variant_opt ( bcx : @mut Block , pat_id : ast:: NodeId )
296
296
-> Opt {
297
297
let ccx = bcx. ccx ( ) ;
298
298
match ccx. tcx . def_map . get_copy ( & pat_id) {
@@ -317,7 +317,7 @@ pub fn variant_opt(bcx: @mut Block, pat_id: ast::NodeId)
317
317
}
318
318
319
319
#[ deriving( Clone ) ]
320
- pub enum TransBindingMode {
320
+ enum TransBindingMode {
321
321
TrByValue ( /*llbinding:*/ ValueRef ) ,
322
322
TrByRef ,
323
323
}
@@ -331,24 +331,24 @@ pub enum TransBindingMode {
331
331
* - `id` is the node id of the binding
332
332
* - `ty` is the Rust type of the binding */
333
333
#[ deriving( Clone ) ]
334
- pub struct BindingInfo {
334
+ struct BindingInfo {
335
335
llmatch : ValueRef ,
336
336
trmode : TransBindingMode ,
337
337
id : ast:: NodeId ,
338
338
ty : ty:: t ,
339
339
}
340
340
341
- pub type BindingsMap = HashMap < ident , BindingInfo > ;
341
+ type BindingsMap = HashMap < ident , BindingInfo > ;
342
342
343
343
#[ deriving( Clone ) ]
344
- pub struct ArmData < ' self > {
344
+ struct ArmData < ' self > {
345
345
bodycx : @mut Block ,
346
346
arm : & ' self ast:: arm ,
347
347
bindings_map : @BindingsMap
348
348
}
349
349
350
350
#[ deriving( Clone ) ]
351
- pub struct Match < ' self > {
351
+ struct Match < ' self > {
352
352
pats : ~[ @ast:: pat ] ,
353
353
data : ArmData < ' self >
354
354
}
@@ -364,7 +364,7 @@ impl<'self> Repr for Match<'self> {
364
364
}
365
365
}
366
366
367
- pub fn has_nested_bindings ( m : & [ Match ] , col : uint ) -> bool {
367
+ fn has_nested_bindings ( m : & [ Match ] , col : uint ) -> bool {
368
368
for br in m. iter ( ) {
369
369
match br. pats [ col] . node {
370
370
ast:: pat_ident( _, _, Some ( _) ) => return true ,
@@ -374,7 +374,7 @@ pub fn has_nested_bindings(m: &[Match], col: uint) -> bool {
374
374
return false ;
375
375
}
376
376
377
- pub fn expand_nested_bindings < ' r > ( bcx : @mut Block ,
377
+ fn expand_nested_bindings < ' r > ( bcx : @mut Block ,
378
378
m : & [ Match < ' r > ] ,
379
379
col : uint ,
380
380
val : ValueRef )
@@ -409,7 +409,7 @@ pub fn expand_nested_bindings<'r>(bcx: @mut Block,
409
409
}
410
410
}
411
411
412
- pub fn assert_is_binding_or_wild ( bcx : @mut Block , p : @ast:: pat ) {
412
+ fn assert_is_binding_or_wild ( bcx : @mut Block , p : @ast:: pat ) {
413
413
if !pat_is_binding_or_wild ( bcx. tcx ( ) . def_map , p) {
414
414
bcx. sess ( ) . span_bug (
415
415
p. span ,
@@ -418,9 +418,9 @@ pub fn assert_is_binding_or_wild(bcx: @mut Block, p: @ast::pat) {
418
418
}
419
419
}
420
420
421
- pub type enter_pat < ' self > = & ' self fn ( @ast:: pat ) -> Option < ~[ @ast:: pat ] > ;
421
+ type enter_pat < ' self > = & ' self fn ( @ast:: pat ) -> Option < ~[ @ast:: pat ] > ;
422
422
423
- pub fn enter_match < ' r > ( bcx : @mut Block ,
423
+ fn enter_match < ' r > ( bcx : @mut Block ,
424
424
dm : DefMap ,
425
425
m : & [ Match < ' r > ] ,
426
426
col : uint ,
@@ -470,7 +470,7 @@ pub fn enter_match<'r>(bcx: @mut Block,
470
470
return result;
471
471
}
472
472
473
- pub fn enter_default < ' r > ( bcx : @mut Block ,
473
+ fn enter_default < ' r > ( bcx : @mut Block ,
474
474
dm : DefMap ,
475
475
m : & [ Match < ' r > ] ,
476
476
col : uint ,
@@ -516,7 +516,7 @@ pub fn enter_default<'r>(bcx: @mut Block,
516
516
// <nmatsakis> so all patterns must either be records (resp. tuples) or
517
517
// wildcards
518
518
519
- pub fn enter_opt < ' r > ( bcx : @mut Block ,
519
+ fn enter_opt < ' r > ( bcx : @mut Block ,
520
520
m : & [ Match < ' r > ] ,
521
521
opt : & Opt ,
522
522
col : uint ,
@@ -628,7 +628,7 @@ pub fn enter_opt<'r>(bcx: @mut Block,
628
628
}
629
629
}
630
630
631
- pub fn enter_rec_or_struct < ' r > ( bcx : @mut Block ,
631
+ fn enter_rec_or_struct < ' r > ( bcx : @mut Block ,
632
632
dm : DefMap ,
633
633
m : & [ Match < ' r > ] ,
634
634
col : uint ,
@@ -663,7 +663,7 @@ pub fn enter_rec_or_struct<'r>(bcx: @mut Block,
663
663
}
664
664
}
665
665
666
- pub fn enter_tup < ' r > ( bcx : @mut Block ,
666
+ fn enter_tup < ' r > ( bcx : @mut Block ,
667
667
dm : DefMap ,
668
668
m : & [ Match < ' r > ] ,
669
669
col : uint ,
@@ -689,7 +689,7 @@ pub fn enter_tup<'r>(bcx: @mut Block,
689
689
}
690
690
}
691
691
692
- pub fn enter_tuple_struct < ' r > ( bcx : @mut Block ,
692
+ fn enter_tuple_struct < ' r > ( bcx : @mut Block ,
693
693
dm : DefMap ,
694
694
m : & [ Match < ' r > ] ,
695
695
col : uint ,
@@ -715,7 +715,7 @@ pub fn enter_tuple_struct<'r>(bcx: @mut Block,
715
715
}
716
716
}
717
717
718
- pub fn enter_box < ' r > ( bcx : @mut Block ,
718
+ fn enter_box < ' r > ( bcx : @mut Block ,
719
719
dm : DefMap ,
720
720
m : & [ Match < ' r > ] ,
721
721
col : uint ,
@@ -742,7 +742,7 @@ pub fn enter_box<'r>(bcx: @mut Block,
742
742
}
743
743
}
744
744
745
- pub fn enter_uniq < ' r > ( bcx : @mut Block ,
745
+ fn enter_uniq < ' r > ( bcx : @mut Block ,
746
746
dm : DefMap ,
747
747
m : & [ Match < ' r > ] ,
748
748
col : uint ,
@@ -769,7 +769,7 @@ pub fn enter_uniq<'r>(bcx: @mut Block,
769
769
}
770
770
}
771
771
772
- pub fn enter_region < ' r > ( bcx : @mut Block ,
772
+ fn enter_region < ' r > ( bcx : @mut Block ,
773
773
dm : DefMap ,
774
774
m : & [ Match < ' r > ] ,
775
775
col : uint ,
@@ -799,7 +799,7 @@ pub fn enter_region<'r>(bcx: @mut Block,
799
799
// Returns the options in one column of matches. An option is something that
800
800
// needs to be conditionally matched at runtime; for example, the discriminant
801
801
// on a set of enum variants or a literal.
802
- pub fn get_options ( bcx : @mut Block , m : & [ Match ] , col : uint ) -> ~[ Opt ] {
802
+ fn get_options ( bcx : @mut Block , m : & [ Match ] , col : uint ) -> ~[ Opt ] {
803
803
let ccx = bcx. ccx ( ) ;
804
804
fn add_to_set ( tcx : ty:: ctxt , set : & mut ~[ Opt ] , val : Opt ) {
805
805
if set. iter ( ) . any ( |l| opt_eq ( tcx, l, & val) ) { return ; }
@@ -865,12 +865,12 @@ pub fn get_options(bcx: @mut Block, m: &[Match], col: uint) -> ~[Opt] {
865
865
return found;
866
866
}
867
867
868
- pub struct ExtractedBlock {
868
+ struct ExtractedBlock {
869
869
vals : ~[ ValueRef ] ,
870
870
bcx : @mut Block
871
871
}
872
872
873
- pub fn extract_variant_args ( bcx : @mut Block ,
873
+ fn extract_variant_args ( bcx : @mut Block ,
874
874
repr : & adt:: Repr ,
875
875
disr_val : uint ,
876
876
val : ValueRef )
@@ -893,7 +893,7 @@ fn match_datum(bcx: @mut Block, val: ValueRef, pat_id: ast::NodeId) -> Datum {
893
893
}
894
894
895
895
896
- pub fn extract_vec_elems ( bcx : @mut Block ,
896
+ fn extract_vec_elems ( bcx : @mut Block ,
897
897
pat_span : span ,
898
898
pat_id : ast:: NodeId ,
899
899
elem_count : uint ,
@@ -948,7 +948,7 @@ pub fn extract_vec_elems(bcx: @mut Block,
948
948
}
949
949
950
950
// NB: This function does not collect fields from struct-like enum variants.
951
- pub fn collect_record_or_struct_fields ( bcx : @mut Block ,
951
+ fn collect_record_or_struct_fields ( bcx : @mut Block ,
952
952
m : & [ Match ] ,
953
953
col : uint )
954
954
-> ~[ ast:: ident ] {
@@ -976,7 +976,7 @@ pub fn collect_record_or_struct_fields(bcx: @mut Block,
976
976
}
977
977
}
978
978
979
- pub fn pats_require_rooting ( bcx : @mut Block ,
979
+ fn pats_require_rooting ( bcx : @mut Block ,
980
980
m : & [ Match ] ,
981
981
col : uint )
982
982
-> bool {
@@ -987,7 +987,7 @@ pub fn pats_require_rooting(bcx: @mut Block,
987
987
}
988
988
}
989
989
990
- pub fn root_pats_as_necessary ( mut bcx : @mut Block ,
990
+ fn root_pats_as_necessary ( mut bcx : @mut Block ,
991
991
m : & [ Match ] ,
992
992
col : uint ,
993
993
val : ValueRef )
@@ -1018,23 +1018,23 @@ macro_rules! any_pat (
1018
1018
)
1019
1019
)
1020
1020
1021
- pub fn any_box_pat ( m : & [ Match ] , col : uint ) -> bool {
1021
+ fn any_box_pat ( m : & [ Match ] , col : uint ) -> bool {
1022
1022
any_pat ! ( m, ast:: pat_box( _) )
1023
1023
}
1024
1024
1025
- pub fn any_uniq_pat ( m : & [ Match ] , col : uint ) -> bool {
1025
+ fn any_uniq_pat ( m : & [ Match ] , col : uint ) -> bool {
1026
1026
any_pat ! ( m, ast:: pat_uniq( _) )
1027
1027
}
1028
1028
1029
- pub fn any_region_pat ( m : & [ Match ] , col : uint ) -> bool {
1029
+ fn any_region_pat ( m : & [ Match ] , col : uint ) -> bool {
1030
1030
any_pat ! ( m, ast:: pat_region( _) )
1031
1031
}
1032
1032
1033
- pub fn any_tup_pat ( m : & [ Match ] , col : uint ) -> bool {
1033
+ fn any_tup_pat ( m : & [ Match ] , col : uint ) -> bool {
1034
1034
any_pat ! ( m, ast:: pat_tup( _) )
1035
1035
}
1036
1036
1037
- pub fn any_tuple_struct_pat ( bcx : @mut Block , m : & [ Match ] , col : uint ) -> bool {
1037
+ fn any_tuple_struct_pat ( bcx : @mut Block , m : & [ Match ] , col : uint ) -> bool {
1038
1038
do m. iter ( ) . any |br| {
1039
1039
let pat = br. pats [ col] ;
1040
1040
match pat. node {
@@ -1050,9 +1050,9 @@ pub fn any_tuple_struct_pat(bcx: @mut Block, m: &[Match], col: uint) -> bool {
1050
1050
}
1051
1051
}
1052
1052
1053
- pub type mk_fail = @fn ( ) -> BasicBlockRef ;
1053
+ type mk_fail = @fn ( ) -> BasicBlockRef ;
1054
1054
1055
- pub fn pick_col ( m : & [ Match ] ) -> uint {
1055
+ fn pick_col ( m : & [ Match ] ) -> uint {
1056
1056
fn score ( p : & ast:: pat ) -> uint {
1057
1057
match p. node {
1058
1058
ast:: pat_lit( _) | ast:: pat_enum( _, _) | ast:: pat_range( _, _) => 1 u,
@@ -1088,7 +1088,7 @@ pub enum branch_kind { no_branch, single, switch, compare, compare_vec_len, }
1088
1088
// Compiles a comparison between two things.
1089
1089
//
1090
1090
// NB: This must produce an i1, not a Rust bool (i8).
1091
- pub fn compare_values ( cx : @mut Block ,
1091
+ fn compare_values ( cx : @mut Block ,
1092
1092
lhs : ValueRef ,
1093
1093
rhs : ValueRef ,
1094
1094
rhs_t : ty:: t )
@@ -1204,7 +1204,7 @@ fn insert_lllocals(bcx: @mut Block,
1204
1204
return bcx;
1205
1205
}
1206
1206
1207
- pub fn compile_guard ( bcx : @mut Block ,
1207
+ fn compile_guard ( bcx : @mut Block ,
1208
1208
guard_expr : @ast:: expr ,
1209
1209
data : & ArmData ,
1210
1210
m : & [ Match ] ,
@@ -1261,7 +1261,7 @@ pub fn compile_guard(bcx: @mut Block,
1261
1261
}
1262
1262
}
1263
1263
1264
- pub fn compile_submatch ( bcx : @mut Block ,
1264
+ fn compile_submatch ( bcx : @mut Block ,
1265
1265
m : & [ Match ] ,
1266
1266
vals : & [ ValueRef ] ,
1267
1267
chk : Option < mk_fail > ) {
@@ -1670,7 +1670,7 @@ fn create_bindings_map(bcx: @mut Block, pat: @ast::pat) -> BindingsMap {
1670
1670
return bindings_map;
1671
1671
}
1672
1672
1673
- pub fn trans_match_inner ( scope_cx : @mut Block ,
1673
+ fn trans_match_inner ( scope_cx : @mut Block ,
1674
1674
discr_expr : @ast:: expr ,
1675
1675
arms : & [ ast:: arm ] ,
1676
1676
dest : Dest ) -> @mut Block {
@@ -1752,7 +1752,7 @@ pub fn trans_match_inner(scope_cx: @mut Block,
1752
1752
}
1753
1753
}
1754
1754
1755
- pub enum IrrefutablePatternBindingMode {
1755
+ enum IrrefutablePatternBindingMode {
1756
1756
// Stores the association between node ID and LLVM value in `lllocals`.
1757
1757
BindLocal ,
1758
1758
// Stores the association between node ID and LLVM value in `llargs`.
0 commit comments