@@ -36,10 +36,10 @@ type scope = @restrict[];
36
36
37
37
tag local_info { arg( ast:: mode) ; objfield ( ast:: mutability) ; }
38
38
39
- type ctx = rec ( ty:: ctxt tcx,
39
+ type ctx = rec ( @ ty:: ctxt tcx,
40
40
std:: map:: hashmap[ node_id, local_info] local_map ) ;
41
41
42
- fn check_crate ( ty:: ctxt tcx, & @ast:: crate crate) {
42
+ fn check_crate ( @ ty:: ctxt tcx, & @ast:: crate crate) {
43
43
auto cx = @rec ( tcx=tcx,
44
44
// Stores information about object fields and function
45
45
// arguments that's otherwise not easily available.
@@ -149,7 +149,7 @@ fn visit_decl(&@ctx cx, &@ast::decl d, &scope sc, &vt[scope] v) {
149
149
150
150
fn check_call( & ctx cx, & @ast:: expr f, & ( @ast:: expr) [ ] args, & scope sc) ->
151
151
rec( node_id[ ] root_vars, ty:: t[ ] unsafe_ts) {
152
- auto fty = ty:: expr_ty( cx. tcx, f) ;
152
+ auto fty = ty:: expr_ty( * cx. tcx, f) ;
153
153
auto arg_ts = fty_args( cx, fty) ;
154
154
let node_id[ ] roots = ~[ ] ;
155
155
let tup( uint, node_id) [ ] mut_roots = ~[ ] ;
@@ -248,7 +248,7 @@ fn check_tail_call(&ctx cx, &@ast::expr call) {
248
248
case ( ast:: expr_call( ?f, ?args_) ) { args = args_; f }
249
249
} ;
250
250
auto i = 0 u;
251
- for ( ty:: arg arg_t in fty_args( cx, ty:: expr_ty( cx. tcx, f) ) ) {
251
+ for ( ty:: arg arg_t in fty_args( cx, ty:: expr_ty( * cx. tcx, f) ) ) {
252
252
if ( arg_t. mode != ty:: mo_val) {
253
253
auto mut_a = arg_t. mode == ty:: mo_alias( true ) ;
254
254
auto ok = true ;
@@ -354,15 +354,15 @@ fn check_for(&ctx cx, &@ast::local local, &@ast::expr seq, &ast::block block,
354
354
auto unsafe = alt ( inner_mut( root. ds) ) { some( ?t) { ~[ t] } _ { ~[ ] } } ;
355
355
356
356
// If this is a mutable vector, don't allow it to be touched.
357
- auto seq_t = ty:: expr_ty( cx. tcx, seq) ;
358
- alt ( ty:: struct( cx. tcx, seq_t) ) {
357
+ auto seq_t = ty:: expr_ty( * cx. tcx, seq) ;
358
+ alt ( ty:: struct( * cx. tcx, seq_t) ) {
359
359
ty:: ty_vec( ?mt) | ty:: ty_ivec( ?mt) {
360
360
if ( mt. mut != ast:: imm) { unsafe = ~[ seq_t] ; }
361
361
}
362
362
ty:: ty_str | ty:: ty_istr { /* no-op */ }
363
363
_ {
364
364
cx. tcx. sess. span_unimpl( seq. span, "unknown seq type " +
365
- util : : ppaux:: ty_to_str( cx. tcx, seq_t) ) ;
365
+ util : : ppaux:: ty_to_str( * cx. tcx, seq_t) ) ;
366
366
}
367
367
}
368
368
auto new_sc =
@@ -380,7 +380,7 @@ fn check_var(&ctx cx, &@ast::expr ex, &ast::path p, ast::node_id id,
380
380
auto def = cx. tcx. def_map. get( id) ;
381
381
if ( !def_is_local( def, true ) ) { ret; }
382
382
auto my_defnum = ast:: def_id_of_def( def) . _1;
383
- auto var_t = ty:: expr_ty( cx. tcx, ex) ;
383
+ auto var_t = ty:: expr_ty( * cx. tcx, ex) ;
384
384
for ( restrict r in * sc) {
385
385
// excludes variables introduced since the alias was made
386
386
if ( my_defnum < r. block_defnum) {
@@ -523,7 +523,7 @@ fn expr_root(&ctx cx, @ast::expr ex, bool autoderef) ->
523
523
rec ( @ast:: expr ex, @deref[ ] ds) {
524
524
fn maybe_auto_unbox ( & ctx cx, & ty:: t t) ->
525
525
rec ( ty:: t t, option:: t[ deref] d ) {
526
- alt ( ty:: struct ( cx. tcx , t) ) {
526
+ alt ( ty:: struct ( * cx. tcx , t) ) {
527
527
case ( ty:: ty_box ( ?mt) ) {
528
528
ret rec ( t=mt. ty ,
529
529
d=some ( @rec ( mut=mt. mut != ast:: imm,
@@ -541,9 +541,9 @@ fn expr_root(&ctx cx, @ast::expr ex, bool autoderef) ->
541
541
alt ( { ex. node } ) {
542
542
case ( ast:: expr_field ( ?base, ?ident) ) {
543
543
auto auto_unbox =
544
- maybe_auto_unbox ( cx, ty:: expr_ty ( cx. tcx , base) ) ;
544
+ maybe_auto_unbox ( cx, ty:: expr_ty ( * cx. tcx , base) ) ;
545
545
auto mut = false ;
546
- alt ( ty:: struct ( cx. tcx , auto_unbox. t ) ) {
546
+ alt ( ty:: struct ( * cx. tcx , auto_unbox. t ) ) {
547
547
case ( ty:: ty_tup ( ?fields) ) {
548
548
auto fnm = ty:: field_num ( cx. tcx . sess , ex. span , ident) ;
549
549
mut = fields. ( fnm) . mut != ast:: imm;
@@ -564,8 +564,8 @@ fn expr_root(&ctx cx, @ast::expr ex, bool autoderef) ->
564
564
}
565
565
case ( ast:: expr_index ( ?base, _) ) {
566
566
auto auto_unbox =
567
- maybe_auto_unbox ( cx, ty:: expr_ty ( cx. tcx , base) ) ;
568
- alt ( ty:: struct ( cx. tcx , auto_unbox. t ) ) {
567
+ maybe_auto_unbox ( cx, ty:: expr_ty ( * cx. tcx , base) ) ;
568
+ alt ( ty:: struct ( * cx. tcx , auto_unbox. t ) ) {
569
569
case ( ty:: ty_vec ( ?mt) ) {
570
570
ds += ~[ @rec ( mut=mt. mut != ast:: imm,
571
571
kind=index,
@@ -582,9 +582,9 @@ fn expr_root(&ctx cx, @ast::expr ex, bool autoderef) ->
582
582
}
583
583
case ( ast:: expr_unary ( ?op, ?base) ) {
584
584
if ( op == ast:: deref) {
585
- auto base_t = ty:: expr_ty ( cx. tcx , base) ;
585
+ auto base_t = ty:: expr_ty ( * cx. tcx , base) ;
586
586
auto mut = false ;
587
- alt ( ty:: struct ( cx. tcx , base_t) ) {
587
+ alt ( ty:: struct ( * cx. tcx , base_t) ) {
588
588
case ( ty:: ty_box ( ?mt) ) { mut = mt. mut != ast:: imm; }
589
589
case ( ty:: ty_res ( _, _, _) ) { }
590
590
case ( ty:: ty_tag ( _, _) ) { }
@@ -598,7 +598,7 @@ fn expr_root(&ctx cx, @ast::expr ex, bool autoderef) ->
598
598
}
599
599
}
600
600
if ( autoderef) {
601
- auto auto_unbox = maybe_auto_unbox ( cx, ty:: expr_ty ( cx. tcx , ex) ) ;
601
+ auto auto_unbox = maybe_auto_unbox ( cx, ty:: expr_ty ( * cx. tcx , ex) ) ;
602
602
maybe_push_auto_unbox( auto_unbox. d , ds) ;
603
603
}
604
604
ret rec( ex=ex, ds=@ds) ;
@@ -669,7 +669,7 @@ fn ty_can_unsafely_include(&ctx cx, ty::t needle, ty::t haystack, bool mut) ->
669
669
_ { ret false; }
670
670
}
671
671
}
672
- ret helper( cx. tcx , needle, haystack, mut) ;
672
+ ret helper( * cx. tcx , needle, haystack, mut) ;
673
673
}
674
674
675
675
fn def_is_local ( & ast:: def d, bool objfields_count ) -> bool {
@@ -681,7 +681,7 @@ fn def_is_local(&ast::def d, bool objfields_count) -> bool {
681
681
}
682
682
683
683
fn fty_args ( & ctx cx, ty:: t fty ) -> ty:: arg [ ] {
684
- ret alt ( ty:: struct ( cx. tcx , ty:: type_autoderef ( cx. tcx , fty) ) ) {
684
+ ret alt ( ty:: struct ( * cx. tcx , ty:: type_autoderef ( * cx. tcx , fty) ) ) {
685
685
ty:: ty_fn ( _, ?args, _, _, _) | ty:: ty_native_fn ( _, ?args, _) { args }
686
686
} ;
687
687
}
0 commit comments