@@ -61,26 +61,26 @@ tag abbrev_ctxt {
61
61
mod Encode {
62
62
63
63
type ctxt = rec (
64
- fn ( ast. def_id ) -> str ds, // Def -> str Callback.
64
+ fn ( & ast. def_id ) -> str ds, // Def -> str Callback.
65
65
ty. ctxt tcx , // The type context.
66
66
abbrev_ctxt abbrevs
67
67
) ;
68
68
69
- fn cx_uses_abbrevs ( @ctxt cx ) -> bool {
69
+ fn cx_uses_abbrevs ( & @ctxt cx ) -> bool {
70
70
alt ( cx. abbrevs ) {
71
71
case ( ac_no_abbrevs) { ret false ; }
72
72
case ( ac_use_abbrevs ( _) ) { ret true ; }
73
73
}
74
74
}
75
75
76
- fn ty_str ( @ctxt cx , ty . t t) -> str {
76
+ fn ty_str ( & @ctxt cx , & ty . t t) -> str {
77
77
assert ( !cx_uses_abbrevs ( cx) ) ;
78
78
auto sw = IO . string_writer ( ) ;
79
79
enc_ty ( sw. get_writer ( ) , cx, t) ;
80
80
ret sw. get_str ( ) ;
81
81
}
82
82
83
- fn enc_ty ( IO . writer w , @ctxt cx , ty . t t) {
83
+ fn enc_ty ( & IO . writer w , & @ctxt cx , & ty . t t) {
84
84
alt ( cx. abbrevs ) {
85
85
case ( ac_no_abbrevs) { enc_sty ( w, cx, ty. struct ( cx. tcx , t) ) ; }
86
86
case ( ac_use_abbrevs ( ?abbrevs) ) {
@@ -121,7 +121,7 @@ mod Encode {
121
121
}
122
122
}
123
123
124
- fn enc_mt ( IO . writer w , @ctxt cx , & ty. mt mt ) {
124
+ fn enc_mt ( & IO . writer w , & @ctxt cx , & ty. mt mt ) {
125
125
alt ( mt. mut ) {
126
126
case ( ast. imm ) { }
127
127
case ( ast. mut ) { w. write_char ( 'm' ) ; }
@@ -130,7 +130,7 @@ mod Encode {
130
130
enc_ty( w, cx, mt. ty) ;
131
131
}
132
132
133
- fn enc_sty ( IO . writer w , @ctxt cx , ty. sty st ) {
133
+ fn enc_sty ( & IO . writer w , & @ctxt cx , & ty. sty st ) {
134
134
alt ( st) {
135
135
case ( ty. ty_nil ) { w. write_char ( 'n' ) ; }
136
136
case ( ty. ty_bool ) { w. write_char ( 'b' ) ; }
@@ -231,14 +231,14 @@ mod Encode {
231
231
}
232
232
}
233
233
234
- fn enc_proto ( IO . writer w , ast. proto proto ) {
234
+ fn enc_proto ( & IO . writer w , ast. proto proto ) {
235
235
alt ( proto) {
236
236
case ( ast. proto_iter ) { w. write_char ( 'W' ) ; }
237
237
case ( ast. proto_fn ) { w. write_char ( 'F' ) ; }
238
238
}
239
239
}
240
240
241
- fn enc_ty_fn ( IO . writer w , @ctxt cx , vec[ ty. arg] args , ty. t out ) {
241
+ fn enc_ty_fn ( & IO . writer w , & @ctxt cx , & vec[ ty. arg] args , & ty. t out ) {
242
242
w. write_char ( '[' ) ;
243
243
for ( ty. arg arg in args) {
244
244
if ( arg. mode == ty. mo_alias ) { w. write_char ( '&' ) ; }
@@ -252,14 +252,14 @@ mod Encode {
252
252
253
253
254
254
// Returns a Plain Old LLVM String.
255
- fn C_postr ( str s) -> ValueRef {
255
+ fn C_postr ( & str s) -> ValueRef {
256
256
ret llvm. LLVMConstString ( Str . buf ( s) , Str . byte_len ( s) , False ) ;
257
257
}
258
258
259
259
260
260
// Path table encoding
261
261
262
- fn encode_name ( & EBML . writer ebml_w , str name ) {
262
+ fn encode_name ( & EBML . writer ebml_w , & str name ) {
263
263
EBML . start_tag ( ebml_w, tag_paths_data_name) ;
264
264
ebml_w. writer . write ( Str . bytes ( name) ) ;
265
265
EBML . end_tag ( ebml_w) ;
@@ -272,8 +272,8 @@ fn encode_def_id(&EBML.writer ebml_w, &ast.def_id id) {
272
272
}
273
273
274
274
fn encode_tag_variant_paths ( & EBML . writer ebml_w ,
275
- vec[ ast. variant] variants ,
276
- vec[ str] path ,
275
+ & vec[ ast. variant] variants ,
276
+ & vec[ str] path ,
277
277
& mutable vec[ tup( str, uint) ] index ) {
278
278
for ( ast. variant variant in variants) {
279
279
add_to_index ( ebml_w, path, index, variant. node . name ) ;
@@ -285,16 +285,16 @@ fn encode_tag_variant_paths(&EBML.writer ebml_w,
285
285
}
286
286
287
287
fn add_to_index ( & EBML . writer ebml_w ,
288
- vec[ str] path ,
288
+ & vec[ str] path ,
289
289
& mutable vec[ tup( str, uint) ] index ,
290
- str name ) {
290
+ & str name ) {
291
291
auto full_path = path + vec ( name) ;
292
292
index += vec ( tup ( Str . connect ( full_path, "." ) , ebml_w. writer . tell ( ) ) ) ;
293
293
}
294
294
295
295
fn encode_native_module_item_paths ( & EBML . writer ebml_w ,
296
296
& ast. native_mod nmod ,
297
- vec[ str] path ,
297
+ & vec[ str] path ,
298
298
& mutable vec[ tup( str, uint) ] index ) {
299
299
for ( @ast. native_item nitem in nmod. items) {
300
300
alt ( nitem. node ) {
@@ -318,7 +318,7 @@ fn encode_native_module_item_paths(&EBML.writer ebml_w,
318
318
319
319
fn encode_module_item_paths ( & EBML . writer ebml_w ,
320
320
& ast. _mod module ,
321
- vec[ str] path ,
321
+ & vec[ str] path ,
322
322
& mutable vec[ tup( str, uint) ] index ) {
323
323
// TODO: only encode exported items
324
324
for ( @ast. item it in module. items ) {
@@ -382,7 +382,7 @@ fn encode_module_item_paths(&EBML.writer ebml_w,
382
382
}
383
383
}
384
384
385
- fn encode_item_paths ( & EBML . writer ebml_w , @ast. crate crate)
385
+ fn encode_item_paths ( & EBML . writer ebml_w , & @ast. crate crate)
386
386
-> vec[ tup ( str , uint ) ] {
387
387
let vec[ tup( str, uint) ] index = vec ( ) ;
388
388
let vec[ str] path = vec ( ) ;
@@ -401,23 +401,23 @@ fn encode_kind(&EBML.writer ebml_w, u8 c) {
401
401
EBML . end_tag ( ebml_w) ;
402
402
}
403
403
404
- fn def_to_str ( ast. def_id did ) -> str {
404
+ fn def_to_str ( & ast. def_id did ) -> str {
405
405
ret #fmt( "%d:%d" , did. _0 , did. _1 ) ;
406
406
}
407
407
408
- fn encode_type_param_count ( & EBML . writer ebml_w , vec[ ast. ty_param] tps ) {
408
+ fn encode_type_param_count ( & EBML . writer ebml_w , & vec[ ast. ty_param] tps ) {
409
409
EBML . start_tag ( ebml_w, tag_items_data_item_ty_param_count) ;
410
410
EBML . write_vint ( ebml_w. writer , Vec . len [ ast. ty_param ] ( tps) ) ;
411
411
EBML . end_tag ( ebml_w) ;
412
412
}
413
413
414
- fn encode_variant_id ( & EBML . writer ebml_w , ast. def_id vid ) {
414
+ fn encode_variant_id ( & EBML . writer ebml_w , & ast. def_id vid ) {
415
415
EBML . start_tag ( ebml_w, tag_items_data_item_variant) ;
416
416
ebml_w. writer . write ( Str . bytes ( def_to_str ( vid) ) ) ;
417
417
EBML . end_tag ( ebml_w) ;
418
418
}
419
419
420
- fn encode_type ( @trans. crate_ctxt cx , & EBML . writer ebml_w , ty. t typ ) {
420
+ fn encode_type ( & @trans. crate_ctxt cx , & EBML . writer ebml_w , & ty. t typ ) {
421
421
EBML . start_tag ( ebml_w, tag_items_data_item_type) ;
422
422
423
423
auto f = def_to_str;
@@ -427,14 +427,15 @@ fn encode_type(@trans.crate_ctxt cx, &EBML.writer ebml_w, ty.t typ) {
427
427
EBML . end_tag ( ebml_w) ;
428
428
}
429
429
430
- fn encode_symbol ( @trans. crate_ctxt cx , & EBML . writer ebml_w , ast. def_id did ) {
430
+ fn encode_symbol ( & @trans. crate_ctxt cx , & EBML . writer ebml_w ,
431
+ & ast. def_id did ) {
431
432
EBML . start_tag ( ebml_w, tag_items_data_item_symbol) ;
432
433
ebml_w. writer . write ( Str . bytes ( cx. item_symbols . get ( did) ) ) ;
433
434
EBML . end_tag ( ebml_w) ;
434
435
}
435
436
436
- fn encode_discriminant ( @trans. crate_ctxt cx , & EBML . writer ebml_w ,
437
- ast. def_id did ) {
437
+ fn encode_discriminant ( & @trans. crate_ctxt cx , & EBML . writer ebml_w ,
438
+ & ast. def_id did ) {
438
439
EBML . start_tag ( ebml_w, tag_items_data_item_symbol) ;
439
440
ebml_w. writer . write ( Str . bytes ( cx. discrim_symbols . get ( did) ) ) ;
440
441
EBML . end_tag ( ebml_w) ;
@@ -453,10 +454,10 @@ fn encode_obj_type_id(&EBML.writer ebml_w, &ast.def_id id) {
453
454
}
454
455
455
456
456
- fn encode_tag_variant_info ( @trans. crate_ctxt cx , & EBML . writer ebml_w ,
457
- ast. def_id did , vec[ ast. variant] variants ,
457
+ fn encode_tag_variant_info ( & @trans. crate_ctxt cx , & EBML . writer ebml_w ,
458
+ & ast. def_id did , & vec[ ast. variant] variants ,
458
459
& mutable vec[ tup( int, uint) ] index ,
459
- vec[ ast. ty_param] ty_params ) {
460
+ & vec[ ast. ty_param] ty_params ) {
460
461
for ( ast. variant variant in variants) {
461
462
index += vec ( tup ( variant. node . id . _1 , ebml_w. writer . tell ( ) ) ) ;
462
463
@@ -547,8 +548,8 @@ fn encode_info_for_item(@trans.crate_ctxt cx, &EBML.writer ebml_w,
547
548
}
548
549
}
549
550
550
- fn encode_info_for_native_item ( @trans. crate_ctxt cx , & EBML . writer ebml_w ,
551
- @ast. native_item nitem ) {
551
+ fn encode_info_for_native_item ( & @trans. crate_ctxt cx , & EBML . writer ebml_w ,
552
+ & @ast. native_item nitem ) {
552
553
EBML . start_tag ( ebml_w, tag_items_data_item) ;
553
554
alt ( nitem. node ) {
554
555
case ( ast. native_item_ty ( _, ?did) ) {
@@ -567,7 +568,7 @@ fn encode_info_for_native_item(@trans.crate_ctxt cx, &EBML.writer ebml_w,
567
568
EBML . end_tag ( ebml_w) ;
568
569
}
569
570
570
- fn encode_info_for_items ( @trans. crate_ctxt cx , & EBML . writer ebml_w )
571
+ fn encode_info_for_items ( & @trans. crate_ctxt cx , & EBML . writer ebml_w )
571
572
-> vec[ tup ( int , uint ) ] {
572
573
let vec[ tup( int, uint) ] index = vec ( ) ;
573
574
@@ -603,7 +604,7 @@ fn hash_path(&str s) -> uint {
603
604
ret h;
604
605
}
605
606
606
- fn create_index[ T ] ( vec[ tup ( T , uint) ] index, fn ( & T ) -> uint hash_fn)
607
+ fn create_index[ T ] ( & vec[ tup ( T , uint) ] index, fn ( & T ) -> uint hash_fn)
607
608
-> vec[ vec[ tup ( T , uint) ] ] {
608
609
let vec[ vec[ tup ( T , uint) ] ] buckets = vec ( ) ;
609
610
for each ( uint i in UInt . range( 0 u, 256 u) ) {
@@ -619,8 +620,8 @@ fn create_index[T](vec[tup(T, uint)] index, fn(&T) -> uint hash_fn)
619
620
ret buckets;
620
621
}
621
622
622
- fn encode_index[ T ] ( & EBML . writer ebml_w, vec[ vec[ tup( T , uint) ] ] buckets,
623
- fn( IO . writer, & T ) write_fn) {
623
+ fn encode_index[ T ] ( & EBML . writer ebml_w, & vec[ vec[ tup( T , uint) ] ] buckets,
624
+ fn( & IO . writer, & T ) write_fn) {
624
625
auto writer = IO . new_writer_( ebml_w. writer) ;
625
626
626
627
EBML . start_tag( ebml_w, tag_index) ;
@@ -650,16 +651,16 @@ fn encode_index[T](&EBML.writer ebml_w, vec[vec[tup(T, uint)]] buckets,
650
651
EBML . end_tag( ebml_w) ;
651
652
}
652
653
653
- fn write_str( IO . writer writer, & str s) {
654
+ fn write_str( & IO . writer writer, & str s) {
654
655
writer. write_str( s) ;
655
656
}
656
657
657
- fn write_int( IO . writer writer, & int n) {
658
+ fn write_int( & IO . writer writer, & int n) {
658
659
writer. write_be_uint( n as uint, 4 u) ;
659
660
}
660
661
661
662
662
- fn encode_metadata( @trans. crate_ctxt cx, @ast. crate crate)
663
+ fn encode_metadata( & @trans. crate_ctxt cx, & @ast. crate crate)
663
664
-> ValueRef {
664
665
auto string_w = IO . string_writer( ) ;
665
666
auto buf_w = string_w. get_writer( ) . get_buf_writer( ) ;
@@ -690,7 +691,7 @@ fn encode_metadata(@trans.crate_ctxt cx, @ast.crate crate)
690
691
ret C_postr ( string_w. get_str( ) ) ;
691
692
}
692
693
693
- fn write_metadata( @trans. crate_ctxt cx, @ast. crate crate ) {
694
+ fn write_metadata( & @trans. crate_ctxt cx, & @ast. crate crate) {
694
695
auto llmeta = C_postr ( "" ) ;
695
696
if ( cx. sess. get_opts( ) . shared) {
696
697
llmeta = encode_metadata( cx, crate ) ;
0 commit comments