Skip to content

Commit 48467c4

Browse files
committed
Comment tweaks and re-flows.
1 parent f371482 commit 48467c4

File tree

1 file changed

+24
-30
lines changed

1 file changed

+24
-30
lines changed

src/comp/middle/trans.rs

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,7 +1680,7 @@ fn make_cmp_glue(cx: &@block_ctxt, lhs0: ValueRef, rhs0: ValueRef, t: &ty::t,
16801680
}
16811681

16821682

1683-
// Used only for creating scalar comparsion glue.
1683+
// Used only for creating scalar comparison glue.
16841684
tag scalar_type { nil_type; signed_int; unsigned_int; floating_point; }
16851685

16861686

@@ -5662,19 +5662,14 @@ fn trans_anon_obj(bcx: @block_ctxt, sp: &span, anon_obj: &ast::anon_obj,
56625662
let vtbl;
56635663
alt anon_obj.inner_obj {
56645664
none. {
5665-
// If there's no inner_obj -- that is, if we're just adding new
5666-
// fields rather than extending an existing object -- then we just
5667-
// pass the outer object to create_vtbl(). Our vtable won't need
5668-
// to have any forwarding slots.
5669-
56705665
// We need a dummy inner_obj_ty for setting up the object body
56715666
// later.
56725667
inner_obj_ty = ty::mk_type(ccx.tcx);
56735668

5674-
// This seems a little strange, because it'll come into
5675-
// create_vtbl() with no "additional methods". What's happening
5676-
// is that, since *all* of the methods are "additional", we can
5677-
// get away with acting like none of them are.
5669+
// If there's no inner_obj -- that is, if we're just adding new
5670+
// fields rather than extending an existing object -- then we just
5671+
// pass the outer object to create_vtbl(). Our vtable won't need
5672+
// to have any forwarding slots.
56785673
vtbl =
56795674
create_vtbl(bcx.fcx.lcx, sp, outer_obj_ty, wrapper_obj, ~[], none,
56805675
additional_field_tys);
@@ -6770,19 +6765,19 @@ fn create_vtbl(cx: @local_ctxt, sp: &span, outer_obj_ty: ty::t,
67706765
some(inner_obj_ty) {
67716766
// Handle forwarding slots.
67726767

6773-
// If this vtable is being created for an extended object, then
6774-
// the vtable needs to contain 'forwarding slots' for methods that
6775-
// were on the original object and are not being overloaded by the
6776-
// extended one. So, to find the set of methods that we need
6777-
// forwarding slots for, we need to take the set difference of
6778-
// inner_obj_methods (methods on the original object) and
6779-
// ob.methods (methods on the object being added).
6768+
// If this vtable is being created for an extended object, then the
6769+
// vtable needs to contain 'forwarding slots' for methods that were on
6770+
// the original object and are not being overloaded by the extended
6771+
// one. So, to find the set of methods that we need forwarding slots
6772+
// for, we need to take the set difference of inner_obj_methods
6773+
// (methods on the original object) and ob.methods (methods on the
6774+
// object being added).
67806775

6781-
// If we're here, then inner_obj_ty and llinner_obj_ty are the type
6782-
// of the inner object, and "ob" is the wrapper object. We need
6783-
// to take apart inner_obj_ty (it had better have an object type
6784-
// with methods!) and put those original methods onto the list of
6785-
// methods we need forwarding methods for.
6776+
// If we're here, then inner_obj_ty and llinner_obj_ty are the type of
6777+
// the inner object, and "ob" is the wrapper object. We need to take
6778+
// apart inner_obj_ty (it had better have an object type with
6779+
// methods!) and put those original methods onto the list of methods
6780+
// we need forwarding methods for.
67866781

67876782
// Gather up methods on the original object in 'meths'.
67886783
alt ty::struct(cx.ccx.tcx, inner_obj_ty) {
@@ -6806,12 +6801,11 @@ fn create_vtbl(cx: @local_ctxt, sp: &span, outer_obj_ty: ty::t,
68066801

68076802
alt m {
68086803
fwding_mthd(fm) {
6809-
// Since fm is a fwding_mthd, and we're checking to
6810-
// see if it's in addtl_meths (which only contains
6811-
// normal_mthds), we can't just check if fm is a
6812-
// member of addtl_meths. Instead, we have to go
6813-
// through addtl_meths and see if there's some method
6814-
// in it that has the same name as fm.
6804+
// Since fm is a fwding_mthd, and we're checking to see if
6805+
// it's in addtl_meths (which only contains normal_mthds), we
6806+
// can't just check if fm is a member of addtl_meths.
6807+
// Instead, we have to go through addtl_meths and see if
6808+
// there's some method in it that has the same name as fm.
68156809
for am: @ast::method in addtl_meths {
68166810
if str::eq(am.node.ident, fm.ident) { ret none; }
68176811
}
@@ -6828,8 +6822,8 @@ fn create_vtbl(cx: @local_ctxt, sp: &span, outer_obj_ty: ty::t,
68286822
meths = std::ivec::filter_map[vtbl_mthd, vtbl_mthd](f, meths);
68296823

68306824

6831-
// And now add the additional ones (both replacements and entirely
6832-
// new ones). These'll just be normal methods.
6825+
// And now add the additional ones (both replacements and entirely new
6826+
// ones). These'll just be normal methods.
68336827
for m: @ast::method in ob.methods { meths += ~[normal_mthd(m)]; }
68346828
}
68356829
}

0 commit comments

Comments
 (0)