Skip to content

Commit cca5847

Browse files
msullivanmarijnh
authored andcommitted
---
yaml --- r: 3520 b: refs/heads/master c: ee45d54 h: refs/heads/master v: v3
1 parent e34a593 commit cca5847

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: b4465aca5ab22447dde52a4a7083d6e3d29e56e2
2+
refs/heads/master: ee45d54a4e14c8ae809b0b6c3111260a3f39ba40

trunk/src/comp/middle/trans.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3367,7 +3367,7 @@ fn trans_compare(&@block_ctxt cx0, ast::binop op, &ty::t t0, ValueRef lhs0,
33673367
auto rhs_r = autoderef(cx, rhs0, t0);
33683368
auto rhs = rhs_r.val;
33693369
cx = rhs_r.bcx;
3370-
auto t = autoderefed_ty(cx.fcx.lcx.ccx, t0);
3370+
auto t = ty::type_autoderef(cx.fcx.lcx.ccx.tcx, t0);
33713371
// Determine the operation we need.
33723372
// FIXME: Use or-patterns when we have them.
33733373

@@ -4126,17 +4126,6 @@ fn autoderef(&@block_ctxt cx, ValueRef v, &ty::t t) -> result {
41264126
ret rslt(cx, v1);
41274127
}
41284128

4129-
fn autoderefed_ty(&@crate_ctxt ccx, &ty::t t) -> ty::t {
4130-
let ty::t t1 = t;
4131-
while (true) {
4132-
alt (ty::struct(ccx.tcx, t1)) {
4133-
case (ty::ty_box(?mt)) { t1 = mt.ty; }
4134-
case (_) { break; }
4135-
}
4136-
}
4137-
ret t1;
4138-
}
4139-
41404129
fn trans_binary(&@block_ctxt cx, ast::binop op, &@ast::expr a, &@ast::expr b)
41414130
-> result {
41424131

@@ -4199,7 +4188,7 @@ fn trans_binary(&@block_ctxt cx, ast::binop op, &@ast::expr a, &@ast::expr b)
41994188
auto rhty = ty::expr_ty(cx.fcx.lcx.ccx.tcx, b);
42004189
rhs = autoderef(rhs.bcx, rhs.val, rhty);
42014190
ret trans_eager_binop(rhs.bcx, op,
4202-
autoderefed_ty(cx.fcx.lcx.ccx, lhty),
4191+
ty::type_autoderef(cx.fcx.lcx.ccx.tcx,lhty),
42034192
lhs.val, rhs.val);
42044193
}
42054194
}
@@ -4910,7 +4899,7 @@ fn trans_path(&@block_ctxt cx, &ast::path p, ast::node_id id) -> lval_result {
49104899
fn trans_field(&@block_ctxt cx, &span sp, ValueRef v, &ty::t t0,
49114900
&ast::ident field, ast::node_id id) -> lval_result {
49124901
auto r = autoderef(cx, v, t0);
4913-
auto t = autoderefed_ty(cx.fcx.lcx.ccx, t0);
4902+
auto t = ty::type_autoderef(cx.fcx.lcx.ccx.tcx, t0);
49144903
alt (ty::struct(cx.fcx.lcx.ccx.tcx, t)) {
49154904
case (ty::ty_tup(_)) {
49164905
let uint ix = ty::field_num(cx.fcx.lcx.ccx.sess, sp, field);

trunk/src/comp/middle/ty.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ export type_is_copyable;
176176
export type_is_tup_like;
177177
export type_is_str;
178178
export type_owns_heap_mem;
179+
export type_autoderef;
179180
export type_param;
180181
export def_to_str;
181182
export unify;
@@ -1281,6 +1282,17 @@ fn type_param(&ctxt cx, &t ty) -> option::t[uint] {
12811282
ret none[uint];
12821283
}
12831284

1285+
fn type_autoderef(&ctxt cx, &ty::t t) -> ty::t {
1286+
let ty::t t1 = t;
1287+
while (true) {
1288+
alt (struct(cx, t1)) {
1289+
case (ty::ty_box(?mt)) { t1 = mt.ty; }
1290+
case (_) { break; }
1291+
}
1292+
}
1293+
ret t1;
1294+
}
1295+
12841296
fn def_to_str(&ast::def_id did) -> str { ret #fmt("%d:%d", did._0, did._1); }
12851297

12861298

0 commit comments

Comments
 (0)