Skip to content

Commit 430a28b

Browse files
committed
Refactor: a backwarding vtable can only have one kind of method.
1 parent 48467c4 commit 430a28b

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

src/comp/middle/trans.rs

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6899,13 +6899,13 @@ fn create_backwarding_vtbl(cx: @local_ctxt, sp: &span, inner_obj_ty: ty::t,
68996899
// outer object. All we know about either one are their types.
69006900

69016901
let llmethods: ValueRef[] = ~[];
6902-
let meths: vtbl_mthd[]= ~[];
6902+
let meths: ty::method[]= ~[];
69036903

69046904
// Gather up methods on the inner object.
69056905
alt ty::struct(cx.ccx.tcx, inner_obj_ty) {
69066906
ty::ty_obj(inner_obj_methods) {
69076907
for m: ty::method in inner_obj_methods {
6908-
meths += ~[fwding_mthd(@m)];
6908+
meths += ~[m];
69096909
}
69106910
}
69116911
_ {
@@ -6916,22 +6916,11 @@ fn create_backwarding_vtbl(cx: @local_ctxt, sp: &span, inner_obj_ty: ty::t,
69166916
}
69176917

69186918
// Methods should have already been sorted, so no need to do so again.
6919-
6920-
for m: vtbl_mthd in meths {
6921-
alt m {
6922-
normal_mthd(nm) {
6923-
cx.ccx.sess.bug("backwarding vtables shouldn't contain \
6924-
normal methods");
6925-
}
6926-
fwding_mthd(fm) {
6927-
// We pass outer_obj_ty to process_fwding_mthd() because it's
6928-
// the one being forwarded to.
6929-
llmethods += ~[process_fwding_mthd(
6930-
cx, sp, fm, ~[], outer_obj_ty,
6931-
none,
6932-
~[])];
6933-
}
6934-
}
6919+
for m: ty::method in meths {
6920+
// We pass outer_obj_ty to process_fwding_mthd() because it's
6921+
// the one being forwarded to.
6922+
llmethods += ~[process_fwding_mthd(
6923+
cx, sp, @m, ~[], outer_obj_ty, none, ~[])];
69356924
}
69366925

69376926
let vtbl = C_struct(llmethods);

0 commit comments

Comments
 (0)