Skip to content

Commit a0c6d0a

Browse files
committed
Comments and cleanup.
1 parent 61ee22d commit a0c6d0a

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/comp/middle/typeck.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ type fn_ctxt =
6868

6969

7070
// Used for ast_ty_to_ty() below.
71-
type ty_getter = fn(&ast::def_id) -> ty::ty_param_count_and_ty ;
71+
type ty_getter = fn(&ast::def_id) -> ty::ty_param_count_and_ty;
7272

7373
fn lookup_local(&@fn_ctxt fcx, &span sp, ast::node_id id) -> int {
7474
alt (fcx.locals.find(id)) {
@@ -1164,6 +1164,7 @@ type gather_result =
11641164
hashmap[ast::node_id, ast::ident] local_names,
11651165
int next_var_id);
11661166

1167+
// Used only as a helper for check_fn.
11671168
fn gather_locals(&@crate_ctxt ccx, &ast::_fn f,
11681169
&ast::node_id id) -> gather_result {
11691170
fn next_var_id(@mutable int nvi) -> int {
@@ -1191,8 +1192,8 @@ fn gather_locals(&@crate_ctxt ccx, &ast::_fn f,
11911192
auto locals = new_int_hash[int]();
11921193
auto local_names = new_int_hash[ast::ident]();
11931194
auto nvi = @mutable 0;
1194-
// Add object fields, if any.
11951195

1196+
// Add object fields, if any.
11961197
alt (get_obj_info(ccx)) {
11971198
case (option::some(?oinfo)) {
11981199
for (ast::obj_field f in oinfo.obj_fields) {
@@ -1204,7 +1205,6 @@ fn gather_locals(&@crate_ctxt ccx, &ast::_fn f,
12041205
case (option::none) {/* no fields */ }
12051206
}
12061207
// Add formal parameters.
1207-
12081208
auto args = ty::ty_fn_args(ccx.tcx, ty::node_id_to_type(ccx.tcx, id));
12091209
auto i = 0u;
12101210
for (ty::arg arg in args) {
@@ -2113,8 +2113,8 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
21132113
context");
21142114
}
21152115
}
2116-
// Grab this method's type out of the current object type.
21172116

2117+
// Grab this method's type out of the current object type.
21182118
alt (structure_of(fcx, expr.span, this_obj_ty)) {
21192119
case (ty::ty_obj(?methods)) {
21202120
for (ty::method method in methods) {
@@ -2268,7 +2268,6 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
22682268
write::ty_only_fixup(fcx, id, fields.(ix).mt.ty);
22692269
}
22702270
case (ty::ty_obj(?methods)) {
2271-
// log_err "checking method_idx 1...";
22722271
let uint ix =
22732272
ty::method_idx(fcx.ccx.tcx.sess, expr.span, field,
22742273
methods);
@@ -2458,14 +2457,14 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
24582457
method_types.(i)));
24592458
i += 1u;
24602459
}
2461-
// Typecheck the methods.
24622460

2461+
// Typecheck the methods.
24632462
for (@ast::method method in anon_obj.methods) {
24642463
check_method(fcx.ccx, method);
24652464
}
24662465
next_ty_var(fcx);
2467-
// Now remove the info from the stack.
24682466

2467+
// Now remove the info from the stack.
24692468
ivec::pop[obj_info](fcx.ccx.obj_infos);
24702469
}
24712470
case (_) {
@@ -2658,13 +2657,12 @@ fn check_item(@crate_ctxt ccx, &@ast::item it) {
26582657

26592658
ccx.obj_infos += ~[rec(obj_fields=ob.fields, this_obj=it.id)];
26602659
// Typecheck the methods.
2661-
26622660
for (@ast::method method in ob.methods) {
26632661
check_method(ccx, method);
26642662
}
26652663
option::may[@ast::method](bind check_method(ccx, _), ob.dtor);
2666-
// Now remove the info from the stack.
26672664

2665+
// Now remove the info from the stack.
26682666
ivec::pop[obj_info](ccx.obj_infos);
26692667
}
26702668
case (_) {/* nothing to do */ }

0 commit comments

Comments
 (0)