@@ -35,15 +35,14 @@ tag obj_info {
35
35
type crate_ctxt = { mutable obj_infos: [ obj_info] , tcx: ty:: ctxt} ;
36
36
37
37
type fn_ctxt =
38
- // var_bindings, locals, local_names, and next_var_id are shared
38
+ // var_bindings, locals and next_var_id are shared
39
39
// with any nested functions that capture the environment
40
40
// (and with any functions whose environment is being captured).
41
41
{ ret_ty : ty:: t ,
42
42
purity : ast:: purity ,
43
43
proto : ast:: proto ,
44
44
var_bindings : @ty:: unify:: var_bindings ,
45
45
locals : hashmap < ast:: node_id , int > ,
46
- local_names : hashmap < ast:: node_id , ast:: ident > ,
47
46
next_var_id : @mutable int,
48
47
mutable fixups: [ ast:: node_id ] ,
49
48
ccx : @crate_ctxt } ;
@@ -72,13 +71,6 @@ fn lookup_def(fcx: @fn_ctxt, sp: span, id: ast::node_id) -> ast::def {
72
71
}
73
72
}
74
73
75
- fn ident_for_local ( loc : @ast:: local ) -> ast:: ident {
76
- ret alt loc. node . pat . node {
77
- ast:: pat_bind ( name) { name }
78
- _ { "local" }
79
- } ; // FIXME DESTR
80
- }
81
-
82
74
// Returns the type parameter count and the type for the given definition.
83
75
fn ty_param_kinds_and_ty_for_def ( fcx : @fn_ctxt , sp : span , defn : ast:: def ) ->
84
76
ty_param_kinds_and_ty {
@@ -1117,36 +1109,31 @@ mod writeback {
1117
1109
type gather_result =
1118
1110
{ var_bindings : @ty:: unify:: var_bindings ,
1119
1111
locals : hashmap < ast:: node_id , int > ,
1120
- local_names : hashmap < ast:: node_id , ast:: ident > ,
1121
1112
next_var_id : @mutable int} ;
1122
1113
1123
1114
// Used only as a helper for check_fn.
1124
1115
fn gather_locals ( ccx : @crate_ctxt , f : ast:: _fn , id : ast:: node_id ,
1125
1116
old_fcx : option:: t < @fn_ctxt > ) -> gather_result {
1126
- let { vb: vb , locals : locals , local_names : local_names , nvi : nvi } =
1117
+ let { vb: vb , locals : locals , nvi : nvi } =
1127
1118
alt old_fcx {
1128
1119
none. {
1129
1120
{ vb : ty:: unify:: mk_var_bindings ( ) ,
1130
1121
locals : new_int_hash :: < int > ( ) ,
1131
- local_names : new_int_hash :: < ast:: ident > ( ) ,
1132
1122
nvi : @mutable 0 }
1133
1123
}
1134
1124
some ( fcx) {
1135
1125
{ vb: fcx. var_bindings ,
1136
1126
locals: fcx. locals ,
1137
- local_names: fcx. local_names ,
1138
1127
nvi: fcx. next_var_id }
1139
1128
}
1140
1129
} ;
1141
1130
let tcx = ccx. tcx ;
1142
1131
1143
1132
let next_var_id = lambda ( ) -> int { let rv = * nvi; * nvi += 1 ; ret rv; } ;
1144
1133
let assign =
1145
- lambda ( nid: ast:: node_id, ident: ast:: ident,
1146
- ty_opt: option:: t<ty:: t>) {
1134
+ lambda ( nid: ast:: node_id, ty_opt: option:: t<ty:: t>) {
1147
1135
let var_id = next_var_id ( ) ;
1148
1136
locals. insert ( nid, var_id) ;
1149
- local_names. insert ( nid, ident) ;
1150
1137
alt ty_opt {
1151
1138
none. { /* nothing to do */ }
1152
1139
some( typ) {
@@ -1168,30 +1155,30 @@ fn gather_locals(ccx: @crate_ctxt, f: ast::_fn, id: ast::node_id,
1168
1155
}
1169
1156
for f: ast:: obj_field in obj_fields {
1170
1157
let field_ty = ty:: node_id_to_type ( ccx. tcx , f. id ) ;
1171
- assign ( f. id , f . ident , some ( field_ty) ) ;
1158
+ assign ( f. id , some ( field_ty) ) ;
1172
1159
}
1173
1160
1174
1161
// Add formal parameters.
1175
1162
let args = ty:: ty_fn_args ( ccx. tcx , ty:: node_id_to_type ( ccx. tcx , id) ) ;
1176
1163
let i = 0 u;
1177
1164
for arg: ty:: arg in args {
1178
- assign ( f. decl . inputs [ i] . id , f . decl . inputs [ i ] . ident , some ( arg. ty ) ) ;
1165
+ assign ( f. decl . inputs [ i] . id , some ( arg. ty ) ) ;
1179
1166
i += 1 u;
1180
1167
}
1181
1168
1182
1169
// Add explicitly-declared locals.
1183
1170
let visit_local =
1184
1171
lambda ( local: @ast:: local, & & e : ( ) , v: visit:: vt<( ) >) {
1185
1172
let local_ty = ast_ty_to_ty_crate_infer ( ccx, local. node . ty ) ;
1186
- assign ( local. node . id , ident_for_local ( local ) , local_ty) ;
1173
+ assign ( local. node . id , local_ty) ;
1187
1174
visit:: visit_local ( local, e, v) ;
1188
1175
} ;
1189
1176
1190
1177
// Add pattern bindings.
1191
1178
let visit_pat =
1192
1179
lambda ( p: @ast:: pat, & & e : ( ) , v: visit:: vt<( ) >) {
1193
1180
alt p. node {
1194
- ast:: pat_bind ( ident ) { assign ( p. id , ident , none) ; }
1181
+ ast:: pat_bind ( _ ) { assign ( p. id , none) ; }
1195
1182
_ { /* no-op */ }
1196
1183
}
1197
1184
visit:: visit_pat ( p, e, v) ;
@@ -1214,7 +1201,6 @@ fn gather_locals(ccx: @crate_ctxt, f: ast::_fn, id: ast::node_id,
1214
1201
visit:: visit_block ( f. body , ( ) , visit:: mk_vt ( visit) ) ;
1215
1202
ret { var_bindings : vb,
1216
1203
locals : locals,
1217
- local_names : local_names,
1218
1204
next_var_id : nvi} ;
1219
1205
}
1220
1206
@@ -2409,10 +2395,6 @@ fn check_decl_local(fcx: @fn_ctxt, local: @ast::local) -> bool {
2409
2395
let bot = false ;
2410
2396
2411
2397
alt fcx. locals . find ( local. node . id ) {
2412
- none. {
2413
- fcx . ccx . tcx . sess . bug ( "check_decl_local: local id not found " +
2414
- ident_for_local ( local) ) ;
2415
- }
2416
2398
some ( i) {
2417
2399
let t = ty:: mk_var ( fcx. ccx . tcx , i) ;
2418
2400
write:: ty_only_fixup ( fcx, local. node . id , t) ;
@@ -2498,7 +2480,6 @@ fn check_const(ccx: @crate_ctxt, _sp: span, e: @ast::expr, id: ast::node_id) {
2498
2480
proto: ast:: proto_shared ( ast:: sugar_normal) ,
2499
2481
var_bindings: ty:: unify:: mk_var_bindings ( ) ,
2500
2482
locals: new_int_hash :: < int > ( ) ,
2501
- local_names: new_int_hash :: < ast:: ident > ( ) ,
2502
2483
next_var_id: @mutable 0 ,
2503
2484
mutable fixups: fixups,
2504
2485
ccx: ccx} ;
@@ -2640,7 +2621,6 @@ fn check_fn(ccx: @crate_ctxt, f: ast::_fn, id: ast::node_id,
2640
2621
proto: f. proto ,
2641
2622
var_bindings: gather_result. var_bindings ,
2642
2623
locals: gather_result. locals ,
2643
- local_names: gather_result. local_names ,
2644
2624
next_var_id: gather_result. next_var_id ,
2645
2625
mutable fixups: fixups,
2646
2626
ccx: ccx} ;
0 commit comments