@@ -7129,7 +7129,6 @@ fn trans_anon_obj(@block_ctxt bcx, &span sp, &ast::anon_obj anon_obj,
7129
7129
methods = anon_obj. methods,
7130
7130
dtor = none[ @ast:: method] ) ;
7131
7131
7132
- let option:: t[ result] with_obj_val = none;
7133
7132
let ty:: t with_obj_ty;
7134
7133
auto vtbl;
7135
7134
alt ( anon_obj. with_obj) {
@@ -7152,11 +7151,6 @@ fn trans_anon_obj(@block_ctxt bcx, &span sp, &ast::anon_obj anon_obj,
7152
7151
additional_field_tys) ;
7153
7152
}
7154
7153
case ( some( ?e) ) {
7155
- // If with_obj (the object being extended) exists, translate it.
7156
- // Translating with_obj returns a ValueRef (pointer to a 2-word
7157
- // value) wrapped in a result.
7158
- with_obj_val = some( trans_expr( bcx, e) ) ;
7159
-
7160
7154
// TODO: What makes more sense to get the type of an expr --
7161
7155
// calling ty::expr_ty(ccx.tcx, e) on it or calling
7162
7156
// ty::node_id_to_type(ccx.tcx, id) on its id?
@@ -7327,17 +7321,22 @@ fn trans_anon_obj(@block_ctxt bcx, &span sp, &ast::anon_obj anon_obj,
7327
7321
i += 1 ;
7328
7322
}
7329
7323
7330
- // Copy a pointer to the with_obj into the object's body.
7331
- auto body_with_obj =
7332
- GEP_tup_like ( bcx, body_ty, body. val,
7333
- ~[ 0 , abi:: obj_body_elt_with_obj] ) ;
7334
- bcx = body_with_obj. bcx;
7335
- alt ( with_obj_val) {
7336
- case ( some( ?v) ) {
7324
+ // If there's a with_obj, copy a pointer to it into the object's body.
7325
+ alt ( anon_obj. with_obj) {
7326
+ case ( none) { }
7327
+ case ( some( ?e) ) {
7328
+ // If with_obj (the object being extended) exists, translate
7329
+ // it. Translating with_obj returns a ValueRef (pointer to a
7330
+ // 2-word value) wrapped in a result.
7331
+ let result with_obj_val = trans_expr( bcx, e) ;
7332
+
7333
+ auto body_with_obj =
7334
+ GEP_tup_like ( bcx, body_ty, body. val,
7335
+ ~[ 0 , abi:: obj_body_elt_with_obj] ) ;
7336
+ bcx = body_with_obj. bcx;
7337
7337
bcx = copy_val( bcx, INIT , body_with_obj. val,
7338
- v . val, with_obj_ty) . bcx;
7338
+ with_obj_val . val, with_obj_ty) . bcx;
7339
7339
}
7340
- case ( _) { }
7341
7340
}
7342
7341
7343
7342
// Store box ptr in outer pair.
0 commit comments