@@ -6268,8 +6268,8 @@ fn trans_expr_out(&@block_ctxt cx, &@ast::expr e, out_method output) ->
6268
6268
case ( ast:: expr_spawn( ?dom, ?name, ?func, ?args) ) {
6269
6269
ret trans_spawn( cx, dom, name, func, args, e. id) ;
6270
6270
}
6271
- case ( ast:: expr_anon_obj( ?anon_obj, ?tps, ?odid ) ) {
6272
- ret trans_anon_obj( cx, e. span, anon_obj, tps, odid . ctor , e. id) ;
6271
+ case ( ast:: expr_anon_obj( ?anon_obj, ?tps, _ ) ) {
6272
+ ret trans_anon_obj( cx, e. span, anon_obj, tps, e. id) ;
6273
6273
}
6274
6274
case ( _) {
6275
6275
// The expression is an lvalue. Fall through.
@@ -6929,8 +6929,7 @@ fn recv_val(&@block_ctxt cx, ValueRef to, &@ast::expr from, &ty::t unit_ty,
6929
6929
// instead "inlining" the construction of the object and returning the object
6930
6930
// itself.
6931
6931
fn trans_anon_obj( @block_ctxt bcx, & span sp, & ast:: anon_obj anon_obj,
6932
- & vec[ ast:: ty_param] ty_params, ast:: node_id oid,
6933
- ast:: node_id type_id) -> result {
6932
+ & vec[ ast:: ty_param] ty_params, ast:: node_id id) -> result {
6934
6933
6935
6934
// Right now, we're assuming that anon objs don't take ty params, even
6936
6935
// though the AST supports it. It's nonsensical to write an expression
@@ -6960,7 +6959,7 @@ fn trans_anon_obj(@block_ctxt bcx, &span sp, &ast::anon_obj anon_obj,
6960
6959
6961
6960
// Get the type of the eventual entire anonymous object, possibly with
6962
6961
// extensions. NB: This type includes both inner and outer methods.
6963
- auto outer_obj_ty = ty:: node_id_to_type( ccx. tcx, type_id ) ;
6962
+ auto outer_obj_ty = ty:: node_id_to_type( ccx. tcx, id ) ;
6964
6963
auto llouter_obj_ty = type_of( ccx, sp, outer_obj_ty) ;
6965
6964
6966
6965
// Create a vtable for the anonymous object.
@@ -6979,7 +6978,6 @@ fn trans_anon_obj(@block_ctxt bcx, &span sp, &ast::anon_obj anon_obj,
6979
6978
6980
6979
let result with_obj_val;
6981
6980
let ty:: t with_obj_ty;
6982
- let TypeRef llwith_obj_ty;
6983
6981
auto vtbl;
6984
6982
alt ( anon_obj. with_obj) {
6985
6983
case ( none) {
@@ -7012,8 +7010,6 @@ fn trans_anon_obj(@block_ctxt bcx, &span sp, &ast::anon_obj anon_obj,
7012
7010
with_obj_ty = ty:: expr_ty( ccx. tcx, e) ;
7013
7011
//with_obj_ty = ty::node_id_to_type(ccx.tcx, e.id);
7014
7012
7015
- llwith_obj_ty = type_of( ccx, sp, with_obj_ty) ;
7016
-
7017
7013
// If there's a with_obj, we pass its type along to create_vtbl().
7018
7014
// Part of what create_vtbl() will do is take the set difference
7019
7015
// of methods defined on the original and methods being added.
@@ -7023,7 +7019,7 @@ fn trans_anon_obj(@block_ctxt bcx, &span sp, &ast::anon_obj anon_obj,
7023
7019
// normal vtable entry for every method being added.
7024
7020
vtbl = create_vtbl( bcx. fcx. lcx, llouter_obj_ty, outer_obj_ty,
7025
7021
wrapper_obj, ty_params,
7026
- some( tup ( with_obj_ty, llwith_obj_ty ) ) ,
7022
+ some( with_obj_ty) ,
7027
7023
additional_field_tys) ;
7028
7024
}
7029
7025
}
@@ -7037,7 +7033,7 @@ fn trans_anon_obj(@block_ctxt bcx, &span sp, &ast::anon_obj anon_obj,
7037
7033
vec:: len[ ast:: ty_param] ( ty_params) ) ] ) ) ;
7038
7034
7039
7035
// Take care of cleanups.
7040
- auto t = node_id_type( ccx, type_id ) ;
7036
+ auto t = node_id_type( ccx, id ) ;
7041
7037
find_scope_cx( bcx) . cleanups += [ clean( bind drop_ty( _, pair, t) ) ] ;
7042
7038
7043
7039
// Grab onto the first and second elements of the pair.
@@ -7800,7 +7796,7 @@ fn trans_fn(@local_ctxt cx, &span sp, &ast::_fn f, ValueRef llfndecl,
7800
7796
// helper function for create_vtbl.
7801
7797
fn process_fwding_mthd( @local_ctxt cx, @ty:: method m, TypeRef llself_ty,
7802
7798
ty:: t self_ty, & vec[ ast:: ty_param] ty_params,
7803
- tup ( ty:: t, TypeRef ) with_obj_ty_tup ,
7799
+ ty:: t with_obj_ty ,
7804
7800
ty:: t[ ] additional_field_tys) -> ValueRef {
7805
7801
7806
7802
// NB: self_ty (and llself_ty) is the type of the outer object;
@@ -7816,10 +7812,6 @@ fn process_fwding_mthd(@local_ctxt cx, @ty::method m, TypeRef llself_ty,
7816
7812
// on. That object won't exist until run-time, but we know its type
7817
7813
// statically.
7818
7814
7819
- // Unpack the tuple.
7820
- let ty:: t with_obj_ty = with_obj_ty_tup. _0;
7821
- // TODO: We don't actually need both halves of this.
7822
-
7823
7815
// Create a fake span for functions that expect it. Shouldn't matter what
7824
7816
// it is, since this isn't user-written code. (Possibly better: have
7825
7817
// create_vtable take a span argument and pass it in here?)
@@ -8024,7 +8016,7 @@ fn process_normal_mthd(@local_ctxt cx, @ast::method m, TypeRef llself_ty,
8024
8016
// read-only memory.
8025
8017
fn create_vtbl( @local_ctxt cx, TypeRef llself_ty, ty:: t self_ty,
8026
8018
& ast:: _obj ob, & vec[ ast:: ty_param] ty_params,
8027
- option:: t[ tup ( ty:: t, TypeRef ) ] with_obj_ty_tup ,
8019
+ option:: t[ ty:: t] with_obj_ty ,
8028
8020
ty:: t[ ] additional_field_tys) -> ValueRef {
8029
8021
8030
8022
// Used only inside create_vtbl to distinguish different kinds of slots
@@ -8048,15 +8040,15 @@ fn create_vtbl(@local_ctxt cx, TypeRef llself_ty, ty::t self_ty,
8048
8040
let vec[ ValueRef ] llmethods = [ dtor] ;
8049
8041
let vec[ vtbl_mthd] meths = [ ] ;
8050
8042
8051
- alt ( with_obj_ty_tup ) {
8043
+ alt ( with_obj_ty ) {
8052
8044
case ( none) {
8053
8045
// If there's no with_obj, then we don't need any forwarding
8054
8046
// slots. Just use the object's regular methods.
8055
8047
for ( @ast:: method m in ob. methods) {
8056
8048
meths += [ normal_mthd( m) ] ;
8057
8049
}
8058
8050
}
8059
- case ( some( ?with_obj_ty_tup ) ) {
8051
+ case ( some( ?with_obj_ty ) ) {
8060
8052
// Handle forwarding slots.
8061
8053
8062
8054
// If this vtable is being created for an extended object, then
@@ -8074,7 +8066,7 @@ fn create_vtbl(@local_ctxt cx, TypeRef llself_ty, ty::t self_ty,
8074
8066
// methods we need forwarding methods for.
8075
8067
8076
8068
// Gather up methods on the original object in 'meths'.
8077
- alt ( ty:: struct ( cx. ccx. tcx, with_obj_ty_tup . _0 ) ) {
8069
+ alt ( ty:: struct ( cx. ccx. tcx, with_obj_ty ) ) {
8078
8070
case ( ty:: ty_obj( ?with_obj_methods) ) {
8079
8071
for ( ty:: method m in with_obj_methods) {
8080
8072
meths += [ fwding_mthd( @m) ] ;
@@ -8156,11 +8148,11 @@ fn create_vtbl(@local_ctxt cx, TypeRef llself_ty, ty::t self_ty,
8156
8148
// If we have to process a forwarding method, then we need to know
8157
8149
// about the with_obj's type as well as the outer object's type.
8158
8150
case ( fwding_mthd( ?fm) ) {
8159
- alt ( with_obj_ty_tup ) {
8151
+ alt ( with_obj_ty ) {
8160
8152
case ( none) {
8161
8153
// This shouldn't happen; if we're trying to process a
8162
8154
// forwarding method, then we should always have a
8163
- // with_obj_ty_tup .
8155
+ // with_obj_ty .
8164
8156
cx. ccx. sess. bug( "create_vtbl( ) : trying to create "
8165
8157
+ "forwarding method without a type "
8166
8158
+ "of object to forward to") ;
0 commit comments