Skip to content

Commit 00f54b4

Browse files
committed
Refactoring and cleaning up.
1 parent 94c9138 commit 00f54b4

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

src/comp/middle/typeck.rs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,27 +1207,22 @@ fn gather_locals(&@crate_ctxt ccx, &ast::_fn f,
12071207
auto nvi = @mutable 0;
12081208

12091209
// Add object fields, if any.
1210+
auto obj_fields = ~[];
12101211
alt (get_obj_info(ccx)) {
1211-
case (some(?oinfo)) {
1212+
some(?oinfo) {
12121213
alt (oinfo) {
1213-
case (regular_obj(?obj_fields, _)) {
1214-
for (ast::obj_field f in obj_fields) {
1215-
auto field_ty = ty::node_id_to_type(ccx.tcx, f.id);
1216-
assign(ccx.tcx, vb, locals, local_names, nvi, f.id,
1217-
f.ident, some(field_ty));
1218-
}
1219-
}
1220-
case (anon_obj(?obj_fields, _)) {
1221-
for (ast::obj_field f in obj_fields) {
1222-
auto field_ty = ty::node_id_to_type(ccx.tcx, f.id);
1223-
assign(ccx.tcx, vb, locals, local_names, nvi, f.id,
1224-
f.ident, some(field_ty));
1225-
}
1226-
}
1214+
regular_obj(?ofs, _) { obj_fields = ofs; }
1215+
anon_obj(?ofs, _) { obj_fields = ofs; }
12271216
}
12281217
}
1229-
case (none) {/* no fields */ }
1218+
none { /* no fields */ }
1219+
}
1220+
for (ast::obj_field f in obj_fields) {
1221+
auto field_ty = ty::node_id_to_type(ccx.tcx, f.id);
1222+
assign(ccx.tcx, vb, locals, local_names, nvi, f.id, f.ident,
1223+
some(field_ty));
12301224
}
1225+
12311226
// Add formal parameters.
12321227
auto args = ty::ty_fn_args(ccx.tcx, ty::node_id_to_type(ccx.tcx, id));
12331228
auto i = 0u;

0 commit comments

Comments
 (0)