@@ -513,7 +513,7 @@ fn collect_item_types(@ast.crate crate) -> tup(@ast.crate, @ty_table) {
513
513
514
514
// Type unification
515
515
516
- fn unify( & fn_ctxt fcx, @ty. t expected, @ty. t actual) -> unify_result {
516
+ fn unify( & @ fn_ctxt fcx, @ty. t expected, @ty. t actual) -> unify_result {
517
517
// Wraps the given type in an appropriate cname.
518
518
//
519
519
// TODO: This doesn't do anything yet. We should carry the cname up from
@@ -530,7 +530,7 @@ fn unify(&fn_ctxt fcx, @ty.t expected, @ty.t actual) -> unify_result {
530
530
ret ures_err( terr_mismatch, expected, actual) ;
531
531
}
532
532
533
- fn unify_step( & fn_ctxt fcx, & hashmap[ int, @ty. t] bindings, @ty. t expected,
533
+ fn unify_step( & @ fn_ctxt fcx, & hashmap[ int, @ty. t] bindings, @ty. t expected,
534
534
@ty. t actual) -> unify_result {
535
535
// TODO: rewrite this using tuple pattern matching when available, to
536
536
// avoid all this rightward drift and spikiness.
@@ -877,7 +877,7 @@ fn unify(&fn_ctxt fcx, @ty.t expected, @ty.t actual) -> unify_result {
877
877
878
878
// Requires that the two types unify, and prints an error message if they
879
879
// don't. Returns the unified type.
880
- fn demand( & fn_ctxt fcx, & span sp, @ty. t expected, @ty. t actual) -> @ty. t {
880
+ fn demand( & @ fn_ctxt fcx, & span sp, @ty. t expected, @ty. t actual) -> @ty. t {
881
881
alt ( unify( fcx, expected, actual) ) {
882
882
case ( ures_ok( ?ty) ) {
883
883
ret ty;
@@ -897,7 +897,7 @@ fn demand(&fn_ctxt fcx, &span sp, @ty.t expected, @ty.t actual) -> @ty.t {
897
897
}
898
898
899
899
// Returns true if the two types unify and false if they don't.
900
- fn are_compatible( & fn_ctxt fcx, @ty. t expected, @ty. t actual) -> bool {
900
+ fn are_compatible( & @ fn_ctxt fcx, @ty. t expected, @ty. t actual) -> bool {
901
901
alt ( unify( fcx, expected, actual) ) {
902
902
case ( ures_ok( _) ) { ret true; }
903
903
case ( ures_err( _, _, _) ) { ret false; }
@@ -909,7 +909,7 @@ fn are_compatible(&fn_ctxt fcx, @ty.t expected, @ty.t actual) -> bool {
909
909
//
910
910
// TODO: enforce this via a predicate.
911
911
912
- fn demand_pat( & fn_ctxt fcx, @ty. t expected, @ast. pat pat) -> @ast. pat {
912
+ fn demand_pat( & @ fn_ctxt fcx, @ty. t expected, @ast. pat pat) -> @ast. pat {
913
913
auto p_1 = ast. pat_wild( ast. ann_none) ; // FIXME: typestate botch
914
914
915
915
alt ( pat. node) {
@@ -970,7 +970,7 @@ fn demand_pat(&fn_ctxt fcx, @ty.t expected, @ast.pat pat) -> @ast.pat {
970
970
// TODO: propagate the types downward. This makes the typechecker quadratic,
971
971
// but we can mitigate that if expected == actual == unified.
972
972
973
- fn demand_expr( & fn_ctxt fcx, @ty. t expected, @ast. expr e) -> @ast. expr {
973
+ fn demand_expr( & @ fn_ctxt fcx, @ty. t expected, @ast. expr e) -> @ast. expr {
974
974
// FIXME: botch to work around typestate bug in rustboot
975
975
let vec[ @ast. expr] v = vec( ) ;
976
976
auto e_1 = ast. expr_vec( v, ast. ann_none) ;
@@ -1112,7 +1112,7 @@ fn demand_expr(&fn_ctxt fcx, @ty.t expected, @ast.expr e) -> @ast.expr {
1112
1112
}
1113
1113
1114
1114
// Type unification over typed blocks.
1115
- fn demand_block( & fn_ctxt fcx, @ty. t expected, & ast. block bloc) -> ast. block {
1115
+ fn demand_block( & @ fn_ctxt fcx, @ty. t expected, & ast. block bloc) -> ast. block {
1116
1116
alt ( bloc. node. expr) {
1117
1117
case ( some[ @ast. expr] ( ?e_0) ) {
1118
1118
auto e_1 = demand_expr( fcx, expected, e_0) ;
@@ -1130,7 +1130,7 @@ fn demand_block(&fn_ctxt fcx, @ty.t expected, &ast.block bloc) -> ast.block {
1130
1130
1131
1131
// Writeback: the phase that writes inferred types back into the AST.
1132
1132
1133
- fn writeback_local( & fn_ctxt fcx, & span sp, @ast. local local)
1133
+ fn writeback_local( & @ fn_ctxt fcx, & span sp, @ast. local local)
1134
1134
-> @ast. decl {
1135
1135
if ( !fcx. locals. contains_key( local. id) ) {
1136
1136
fcx. ccx. sess. span_err( sp, "unable to determine type of local: "
@@ -1141,11 +1141,11 @@ fn writeback_local(&fn_ctxt fcx, &span sp, @ast.local local)
1141
1141
ret @fold. respan[ ast. decl_] ( sp, ast. decl_local( local_wb) ) ;
1142
1142
}
1143
1143
1144
- fn writeback( & fn_ctxt fcx, & ast. block block) -> ast. block {
1145
- auto fld = fold. new_identity_fold[ fn_ctxt] ( ) ;
1144
+ fn writeback( & @ fn_ctxt fcx, & ast. block block) -> ast. block {
1145
+ auto fld = fold. new_identity_fold[ @ fn_ctxt] ( ) ;
1146
1146
auto f = writeback_local;
1147
1147
fld = @rec( fold_decl_local = f with * fld) ;
1148
- ret fold. fold_block[ fn_ctxt] ( fcx, fld, block) ;
1148
+ ret fold. fold_block[ @ fn_ctxt] ( fcx, fld, block) ;
1149
1149
}
1150
1150
1151
1151
// AST fragment checking
@@ -1165,7 +1165,7 @@ fn check_lit(@ast.lit lit) -> @ty.t {
1165
1165
ret plain_ty( sty) ;
1166
1166
}
1167
1167
1168
- fn check_pat( & fn_ctxt fcx, @ast. pat pat) -> @ast. pat {
1168
+ fn check_pat( & @ fn_ctxt fcx, @ast. pat pat) -> @ast. pat {
1169
1169
auto new_pat;
1170
1170
alt ( pat. node) {
1171
1171
case ( ast. pat_wild( _) ) {
@@ -1227,7 +1227,7 @@ fn check_pat(&fn_ctxt fcx, @ast.pat pat) -> @ast.pat {
1227
1227
ret @fold. respan[ ast. pat_] ( pat. span, new_pat) ;
1228
1228
}
1229
1229
1230
- fn check_expr( & fn_ctxt fcx, @ast. expr expr) -> @ast. expr {
1230
+ fn check_expr( & @ fn_ctxt fcx, @ast. expr expr) -> @ast. expr {
1231
1231
alt ( expr. node) {
1232
1232
case ( ast. expr_lit( ?lit, _) ) {
1233
1233
auto ty = check_lit( lit) ;
@@ -1711,8 +1711,7 @@ fn next_ty_var(@crate_ctxt ccx) -> @ty.t {
1711
1711
ret t;
1712
1712
}
1713
1713
1714
- fn check_stmt( & fn_ctxt fcx, & @ast. stmt stmt)
1715
- -> @ast. stmt {
1714
+ fn check_stmt( & @fn_ctxt fcx, & @ast. stmt stmt) -> @ast. stmt {
1716
1715
alt ( stmt. node) {
1717
1716
case ( ast. stmt_decl( ?decl) ) {
1718
1717
alt ( decl. node) {
@@ -1800,7 +1799,7 @@ fn check_stmt(&fn_ctxt fcx, &@ast.stmt stmt)
1800
1799
fail;
1801
1800
}
1802
1801
1803
- fn check_block( & fn_ctxt fcx, & ast. block block) -> ast. block {
1802
+ fn check_block( & @ fn_ctxt fcx, & ast. block block) -> ast. block {
1804
1803
let vec[ @ast. stmt] stmts = vec( ) ;
1805
1804
for ( @ast. stmt s in block. node. stmts) {
1806
1805
append[ @ast. stmt] ( stmts, check_stmt( fcx, s) ) ;
@@ -1824,9 +1823,9 @@ fn check_const(&@crate_ctxt ccx, &span sp, ast.ident ident, @ast.ty t,
1824
1823
// FIXME: this is kinda a kludge; we manufacture a fake "function context"
1825
1824
// for checking the initializer expression.
1826
1825
auto rty = ann_to_type( ann) ;
1827
- let fn_ctxt fcx = rec( ret_ty = rty,
1828
- locals = @common. new_def_hash[ @ty. t] ( ) ,
1829
- ccx = ccx) ;
1826
+ let @ fn_ctxt fcx = @ rec( ret_ty = rty,
1827
+ locals = @common. new_def_hash[ @ty. t] ( ) ,
1828
+ ccx = ccx) ;
1830
1829
auto e_ = check_expr( fcx, e) ;
1831
1830
// FIXME: necessary? Correct sequence?
1832
1831
demand_expr( fcx, rty, e_) ;
@@ -1848,9 +1847,9 @@ fn check_fn(&@crate_ctxt ccx, ast.effect effect,
1848
1847
auto input_ty = ast_ty_to_ty_crate( ccx, arg. ty) ;
1849
1848
local_ty_table. insert( arg. id, input_ty) ;
1850
1849
}
1851
- let fn_ctxt fcx = rec( ret_ty = ast_ty_to_ty_crate( ccx, output) ,
1852
- locals = local_ty_table,
1853
- ccx = ccx) ;
1850
+ let @ fn_ctxt fcx = @ rec( ret_ty = ast_ty_to_ty_crate( ccx, output) ,
1851
+ locals = local_ty_table,
1852
+ ccx = ccx) ;
1854
1853
1855
1854
// TODO: Make sure the type of the block agrees with the function type.
1856
1855
auto block_t = check_block( fcx, body) ;
0 commit comments