Skip to content

Commit 64912c9

Browse files
committed
Use an unambiguous abbreviation for "operand" :)
1 parent 5316fe6 commit 64912c9

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

src/rustc/middle/typeck/check.rs

+25-25
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
11321132
// and so forth. - Niko
11331133
fcx.write_nil(expr.id);
11341134
}
1135-
ast::expr_unary(unop, oper) {
1135+
ast::expr_unary(unop, oprnd) {
11361136
let exp_inner = unpack_expected(fcx, expected) {|sty|
11371137
alt unop {
11381138
ast::box(_) | ast::uniq(_) {
@@ -1145,17 +1145,17 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
11451145
ast::deref { none }
11461146
}
11471147
};
1148-
bot = check_expr(fcx, oper, exp_inner);
1149-
let mut oper_t = fcx.expr_ty(oper);
1148+
bot = check_expr(fcx, oprnd, exp_inner);
1149+
let mut oprnd_t = fcx.expr_ty(oprnd);
11501150
alt unop {
11511151
ast::box(mutbl) {
1152-
oper_t = ty::mk_box(tcx, {ty: oper_t, mutbl: mutbl});
1152+
oprnd_t = ty::mk_box(tcx, {ty: oprnd_t, mutbl: mutbl});
11531153
}
11541154
ast::uniq(mutbl) {
1155-
oper_t = ty::mk_uniq(tcx, {ty: oper_t, mutbl: mutbl});
1155+
oprnd_t = ty::mk_uniq(tcx, {ty: oprnd_t, mutbl: mutbl});
11561156
}
11571157
ast::deref {
1158-
let sty = structure_of(fcx, expr.span, oper_t);
1158+
let sty = structure_of(fcx, expr.span, oprnd_t);
11591159

11601160
// deref'ing an unsafe pointer requires that we be in an unsafe
11611161
// context
@@ -1169,7 +1169,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
11691169
}
11701170

11711171
alt ty::deref_sty(tcx, sty, true) {
1172-
some(mt) { oper_t = mt.ty }
1172+
some(mt) { oprnd_t = mt.ty }
11731173
none {
11741174
alt sty {
11751175
ty::ty_enum(*) {
@@ -1183,39 +1183,39 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
11831183
tcx.sess.span_err(
11841184
expr.span,
11851185
#fmt["type %s cannot be dereferenced",
1186-
fcx.infcx.ty_to_str(oper_t)]);
1186+
fcx.infcx.ty_to_str(oprnd_t)]);
11871187
}
11881188
}
11891189
}
11901190
}
11911191
}
11921192
ast::not {
1193-
oper_t = structurally_resolved_type(fcx, oper.span, oper_t);
1194-
if !(ty::type_is_integral(oper_t) ||
1195-
ty::get(oper_t).struct == ty::ty_bool) {
1196-
oper_t = check_user_unop(fcx, "!", "!", expr,
1197-
oper, oper_t);
1193+
oprnd_t = structurally_resolved_type(fcx, oprnd.span, oprnd_t);
1194+
if !(ty::type_is_integral(oprnd_t) ||
1195+
ty::get(oprnd_t).struct == ty::ty_bool) {
1196+
oprnd_t = check_user_unop(fcx, "!", "!", expr,
1197+
oprnd, oprnd_t);
11981198
}
11991199
}
12001200
ast::neg {
1201-
oper_t = structurally_resolved_type(fcx, oper.span, oper_t);
1202-
if !(ty::type_is_integral(oper_t) ||
1203-
ty::type_is_fp(oper_t)) {
1204-
oper_t = check_user_unop(fcx, "-", "unary-", expr,
1205-
oper, oper_t);
1201+
oprnd_t = structurally_resolved_type(fcx, oprnd.span, oprnd_t);
1202+
if !(ty::type_is_integral(oprnd_t) ||
1203+
ty::type_is_fp(oprnd_t)) {
1204+
oprnd_t = check_user_unop(fcx, "-", "unary-", expr,
1205+
oprnd, oprnd_t);
12061206
}
12071207
}
12081208
}
1209-
fcx.write_ty(id, oper_t);
1209+
fcx.write_ty(id, oprnd_t);
12101210
}
1211-
ast::expr_addr_of(mutbl, oper) {
1212-
bot = check_expr(fcx, oper, unpack_expected(fcx, expected) {|ty|
1211+
ast::expr_addr_of(mutbl, oprnd) {
1212+
bot = check_expr(fcx, oprnd, unpack_expected(fcx, expected) {|ty|
12131213
alt ty { ty::ty_rptr(_, mt) { some(mt.ty) } _ { none } }
12141214
});
1215-
let region = region_of(fcx, oper);
1216-
let tm = { ty: fcx.expr_ty(oper), mutbl: mutbl };
1217-
let oper_t = ty::mk_rptr(tcx, region, tm);
1218-
fcx.write_ty(id, oper_t);
1215+
let region = region_of(fcx, oprnd);
1216+
let tm = { ty: fcx.expr_ty(oprnd), mutbl: mutbl };
1217+
let oprnd_t = ty::mk_rptr(tcx, region, tm);
1218+
fcx.write_ty(id, oprnd_t);
12191219
}
12201220
ast::expr_path(pth) {
12211221
let defn = lookup_def(fcx, pth.span, id);

0 commit comments

Comments
 (0)