Skip to content

Commit 356278b

Browse files
committed
---
yaml --- r: 7914 b: refs/heads/snap-stage3 c: 86d473a h: refs/heads/master v: v3
1 parent 990d7b0 commit 356278b

File tree

11 files changed

+202
-305
lines changed

11 files changed

+202
-305
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 2898dcc5d97da9427ac367542382b6239d9c0bbf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 964bd485c6837fa08212451f45878746c9d3d308
4+
refs/heads/snap-stage3: 86d473ad1fa297536b56fb3e1012d7dcbe4f21a3
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/snap-stage3/src/comp/metadata/encoder.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import syntax::ast_util::local_def;
88
import common::*;
99
import middle::trans::common::crate_ctxt;
1010
import middle::ty;
11-
import middle::ty::node_id_to_monotype;
11+
import middle::ty::node_id_to_type;
1212
import front::attr;
1313

1414
export encode_metadata;
@@ -243,7 +243,7 @@ fn encode_enum_variant_info(ecx: @encode_ctxt, ebml_w: ebml::writer,
243243
encode_name(ebml_w, variant.node.name);
244244
encode_enum_id(ebml_w, local_def(id));
245245
encode_type(ecx, ebml_w,
246-
node_id_to_monotype(ecx.ccx.tcx, variant.node.id));
246+
node_id_to_type(ecx.ccx.tcx, variant.node.id));
247247
if vec::len::<variant_arg>(variant.node.args) > 0u {
248248
encode_symbol(ecx, ebml_w, variant.node.id);
249249
}
@@ -287,7 +287,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
287287
ebml::start_tag(ebml_w, tag_items_data_item);
288288
encode_def_id(ebml_w, local_def(item.id));
289289
encode_family(ebml_w, 'c' as u8);
290-
encode_type(ecx, ebml_w, node_id_to_monotype(tcx, item.id));
290+
encode_type(ecx, ebml_w, node_id_to_type(tcx, item.id));
291291
encode_symbol(ecx, ebml_w, item.id);
292292
ebml::end_tag(ebml_w);
293293
}
@@ -301,7 +301,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
301301
impure_fn { 'f' }
302302
} as u8);
303303
encode_type_param_bounds(ebml_w, ecx, tps);
304-
encode_type(ecx, ebml_w, node_id_to_monotype(tcx, item.id));
304+
encode_type(ecx, ebml_w, node_id_to_type(tcx, item.id));
305305
encode_symbol(ecx, ebml_w, item.id);
306306
ebml::end_tag(ebml_w);
307307
}
@@ -320,7 +320,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
320320
encode_def_id(ebml_w, local_def(item.id));
321321
encode_family(ebml_w, 'y' as u8);
322322
encode_type_param_bounds(ebml_w, ecx, tps);
323-
encode_type(ecx, ebml_w, node_id_to_monotype(tcx, item.id));
323+
encode_type(ecx, ebml_w, node_id_to_type(tcx, item.id));
324324
encode_name(ebml_w, item.ident);
325325
ebml::end_tag(ebml_w);
326326
}
@@ -329,7 +329,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
329329
encode_def_id(ebml_w, local_def(item.id));
330330
encode_family(ebml_w, 't' as u8);
331331
encode_type_param_bounds(ebml_w, ecx, tps);
332-
encode_type(ecx, ebml_w, node_id_to_monotype(tcx, item.id));
332+
encode_type(ecx, ebml_w, node_id_to_type(tcx, item.id));
333333
encode_name(ebml_w, item.ident);
334334
for v: variant in variants {
335335
encode_variant_id(ebml_w, local_def(v.node.id));
@@ -338,7 +338,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
338338
encode_enum_variant_info(ecx, ebml_w, item.id, variants, index, tps);
339339
}
340340
item_res(_, tps, _, _, ctor_id) {
341-
let fn_ty = node_id_to_monotype(tcx, ctor_id);
341+
let fn_ty = node_id_to_type(tcx, ctor_id);
342342

343343
ebml::start_tag(ebml_w, tag_items_data_item);
344344
encode_def_id(ebml_w, local_def(ctor_id));
@@ -363,7 +363,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
363363
encode_def_id(ebml_w, local_def(item.id));
364364
encode_family(ebml_w, 'i' as u8);
365365
encode_type_param_bounds(ebml_w, ecx, tps);
366-
encode_type(ecx, ebml_w, node_id_to_monotype(tcx, item.id));
366+
encode_type(ecx, ebml_w, node_id_to_type(tcx, item.id));
367367
encode_name(ebml_w, item.ident);
368368
for m in methods {
369369
ebml::start_tag(ebml_w, tag_item_method);
@@ -389,7 +389,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
389389
encode_family(ebml_w, 'f' as u8);
390390
encode_type_param_bounds(ebml_w, ecx, tps + m.tps);
391391
encode_type(ecx, ebml_w,
392-
node_id_to_monotype(tcx, m.id));
392+
node_id_to_type(tcx, m.id));
393393
encode_name(ebml_w, m.ident);
394394
encode_symbol(ecx, ebml_w, m.id);
395395
ebml::end_tag(ebml_w);
@@ -400,7 +400,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
400400
encode_def_id(ebml_w, local_def(item.id));
401401
encode_family(ebml_w, 'I' as u8);
402402
encode_type_param_bounds(ebml_w, ecx, tps);
403-
encode_type(ecx, ebml_w, node_id_to_monotype(tcx, item.id));
403+
encode_type(ecx, ebml_w, node_id_to_type(tcx, item.id));
404404
encode_name(ebml_w, item.ident);
405405
let i = 0u;
406406
for mty in *ty::iface_methods(tcx, local_def(item.id)) {
@@ -435,7 +435,7 @@ fn encode_info_for_native_item(ecx: @encode_ctxt, ebml_w: ebml::writer,
435435
encode_def_id(ebml_w, local_def(nitem.id));
436436
encode_family(ebml_w, letter);
437437
encode_type_param_bounds(ebml_w, ecx, tps);
438-
encode_type(ecx, ebml_w, node_id_to_monotype(ecx.ccx.tcx, nitem.id));
438+
encode_type(ecx, ebml_w, node_id_to_type(ecx.ccx.tcx, nitem.id));
439439
encode_symbol(ecx, ebml_w, nitem.id);
440440
}
441441
}

branches/snap-stage3/src/comp/middle/kind.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn check_crate(tcx: ty::ctxt, method_map: typeck::method_map,
5959
// closure.
6060
fn with_appropriate_checker(cx: ctx, id: node_id,
6161
b: fn(fn@(ctx, ty::t, sp: span))) {
62-
let fty = ty::node_id_to_monotype(cx.tcx, id);
62+
let fty = ty::node_id_to_type(cx.tcx, id);
6363
alt ty::ty_fn_proto(cx.tcx, fty) {
6464
proto_uniq { b(check_send); }
6565
proto_box { b(check_copy); }
@@ -168,8 +168,7 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
168168
}
169169
}
170170
expr_path(_) {
171-
let substs = ty::node_id_to_ty_param_substs_opt_and_ty(cx.tcx, e.id);
172-
alt substs.substs {
171+
alt cx.tcx.node_type_substs.find(e.id) {
173172
some(ts) {
174173
let did = ast_util::def_id_of_def(cx.tcx.def_map.get(e.id));
175174
let bounds = ty::lookup_item_type(cx.tcx, did).bounds;

branches/snap-stage3/src/comp/middle/last_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fn find_last_uses(c: @crate, def_map: resolve::def_map,
6464
}
6565

6666
fn ex_is_blockish(cx: ctx, id: node_id) -> bool {
67-
alt ty::struct(cx.tcx, ty::node_id_to_monotype(cx.tcx, id)) {
67+
alt ty::struct(cx.tcx, ty::node_id_to_type(cx.tcx, id)) {
6868
ty::ty_fn({proto: p, _}) if is_blockish(p) { true }
6969
_ { false }
7070
}

branches/snap-stage3/src/comp/middle/mut.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ fn is_immutable_def(cx: @ctx, def: def) -> option::t<str> {
268268
def_arg(_, mode_infer) { some("argument") }
269269
def_self(_) { some("self argument") }
270270
def_upvar(_, inner, node_id) {
271-
let ty = ty::node_id_to_monotype(cx.tcx, node_id);
271+
let ty = ty::node_id_to_type(cx.tcx, node_id);
272272
let proto = ty::ty_fn_proto(cx.tcx, ty);
273273
ret alt proto {
274274
proto_any | proto_block { is_immutable_def(cx, *inner) }

branches/snap-stage3/src/comp/middle/trans/alt.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ fn compile_submatch(bcx: @block_ctxt, m: match, vals: [ValueRef], f: mk_fail,
419419
let rec_fields = collect_record_fields(m, col);
420420
// Separate path for extracting and binding record fields
421421
if vec::len(rec_fields) > 0u {
422-
let rec_ty = ty::node_id_to_monotype(ccx.tcx, pat_id);
422+
let rec_ty = ty::node_id_to_type(ccx.tcx, pat_id);
423423
let fields =
424424
alt ty::struct(ccx.tcx, rec_ty) { ty::ty_rec(fields) { fields } };
425425
let rec_vals = [];
@@ -437,7 +437,7 @@ fn compile_submatch(bcx: @block_ctxt, m: match, vals: [ValueRef], f: mk_fail,
437437
}
438438

439439
if any_tup_pat(m, col) {
440-
let tup_ty = ty::node_id_to_monotype(ccx.tcx, pat_id);
440+
let tup_ty = ty::node_id_to_type(ccx.tcx, pat_id);
441441
let n_tup_elts =
442442
alt ty::struct(ccx.tcx, tup_ty) {
443443
ty::ty_tup(elts) { vec::len(elts) }
@@ -492,7 +492,7 @@ fn compile_submatch(bcx: @block_ctxt, m: match, vals: [ValueRef], f: mk_fail,
492492
}
493493
lit(l) {
494494
test_val = Load(bcx, val);
495-
let pty = ty::node_id_to_monotype(ccx.tcx, pat_id);
495+
let pty = ty::node_id_to_type(ccx.tcx, pat_id);
496496
kind = ty::type_is_integral(ccx.tcx, pty) ? switch : compare;
497497
}
498498
range(_, _) {
@@ -709,7 +709,7 @@ fn bind_irrefutable_pat(bcx: @block_ctxt, pat: @ast::pat, val: ValueRef,
709709
alt normalize_pat(bcx_tcx(bcx), pat).node {
710710
ast::pat_ident(_,inner) {
711711
if make_copy || ccx.copy_map.contains_key(pat.id) {
712-
let ty = ty::node_id_to_monotype(ccx.tcx, pat.id);
712+
let ty = ty::node_id_to_type(ccx.tcx, pat.id);
713713
// FIXME: Could constrain pat_bind to make this
714714
// check unnecessary.
715715
check (type_has_static_size(ccx, ty));
@@ -737,7 +737,7 @@ fn bind_irrefutable_pat(bcx: @block_ctxt, pat: @ast::pat, val: ValueRef,
737737
}
738738
}
739739
ast::pat_rec(fields, _) {
740-
let rec_ty = ty::node_id_to_monotype(ccx.tcx, pat.id);
740+
let rec_ty = ty::node_id_to_type(ccx.tcx, pat.id);
741741
let rec_fields =
742742
alt ty::struct(ccx.tcx, rec_ty) { ty::ty_rec(fields) { fields } };
743743
for f: ast::field_pat in fields {
@@ -749,7 +749,7 @@ fn bind_irrefutable_pat(bcx: @block_ctxt, pat: @ast::pat, val: ValueRef,
749749
}
750750
}
751751
ast::pat_tup(elems) {
752-
let tup_ty = ty::node_id_to_monotype(ccx.tcx, pat.id);
752+
let tup_ty = ty::node_id_to_type(ccx.tcx, pat.id);
753753
let i = 0u;
754754
for elem in elems {
755755
// how to get rid of this check?

branches/snap-stage3/src/comp/middle/trans/base.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,7 +2048,7 @@ fn trans_lit(cx: @block_ctxt, lit: ast::lit, dest: dest) -> @block_ctxt {
20482048

20492049
// Converts an annotation to a type
20502050
fn node_id_type(cx: @crate_ctxt, id: ast::node_id) -> ty::t {
2051-
ret ty::node_id_to_monotype(cx.tcx, id);
2051+
ret ty::node_id_to_type(cx.tcx, id);
20522052
}
20532053

20542054
fn trans_unary(bcx: @block_ctxt, op: ast::unop, e: @ast::expr,
@@ -2057,7 +2057,7 @@ fn trans_unary(bcx: @block_ctxt, op: ast::unop, e: @ast::expr,
20572057
alt bcx_ccx(bcx).method_map.find(un_expr.id) {
20582058
some(origin) {
20592059
let callee_id = ast_util::op_expr_callee_id(un_expr);
2060-
let fty = ty::node_id_to_monotype(bcx_tcx(bcx), callee_id);
2060+
let fty = ty::node_id_to_type(bcx_tcx(bcx), callee_id);
20612061
ret trans_call_inner(bcx, fty, {|bcx|
20622062
impl::trans_method_callee(bcx, callee_id, e, origin)
20632063
}, [], un_expr.id, dest);
@@ -2195,7 +2195,7 @@ fn trans_assign_op(bcx: @block_ctxt, ex: @ast::expr, op: ast::binop,
21952195
alt bcx_ccx(bcx).method_map.find(ex.id) {
21962196
some(origin) {
21972197
let callee_id = ast_util::op_expr_callee_id(ex);
2198-
let fty = ty::node_id_to_monotype(bcx_tcx(bcx), callee_id);
2198+
let fty = ty::node_id_to_type(bcx_tcx(bcx), callee_id);
21992199
ret trans_call_inner(bcx, fty, {|bcx|
22002200
// FIXME provide the already-computed address, not the expr
22012201
impl::trans_method_callee(bcx, callee_id, dst, origin)
@@ -2317,7 +2317,7 @@ fn trans_binary(bcx: @block_ctxt, op: ast::binop, lhs: @ast::expr,
23172317
alt bcx_ccx(bcx).method_map.find(ex.id) {
23182318
some(origin) {
23192319
let callee_id = ast_util::op_expr_callee_id(ex);
2320-
let fty = ty::node_id_to_monotype(bcx_tcx(bcx), callee_id);
2320+
let fty = ty::node_id_to_type(bcx_tcx(bcx), callee_id);
23212321
ret trans_call_inner(bcx, fty, {|bcx|
23222322
impl::trans_method_callee(bcx, callee_id, lhs, origin)
23232323
}, [rhs], ex.id, dest);
@@ -2681,7 +2681,7 @@ fn trans_var(cx: @block_ctxt, def: ast::def, id: ast::node_id)
26812681
assert (ccx.consts.contains_key(did.node));
26822682
ret lval_no_env(cx, ccx.consts.get(did.node), owned);
26832683
} else {
2684-
let tp = ty::node_id_to_monotype(ccx.tcx, id);
2684+
let tp = ty::node_id_to_type(ccx.tcx, id);
26852685
let val = trans_external_path(cx, did, {bounds: @[], ty: tp});
26862686
ret lval_no_env(cx, load_if_immediate(cx, val, tp), owned_imm);
26872687
}
@@ -3544,7 +3544,7 @@ fn trans_expr(bcx: @block_ctxt, e: @ast::expr, dest: dest) -> @block_ctxt {
35443544
// If it is here, it's not an lval, so this is a user-defined index op
35453545
let origin = bcx_ccx(bcx).method_map.get(e.id);
35463546
let callee_id = ast_util::op_expr_callee_id(e);
3547-
let fty = ty::node_id_to_monotype(tcx, callee_id);
3547+
let fty = ty::node_id_to_type(tcx, callee_id);
35483548
ret trans_call_inner(bcx, fty, {|bcx|
35493549
impl::trans_method_callee(bcx, callee_id, base, origin)
35503550
}, [idx], e.id, dest);

branches/snap-stage3/src/comp/middle/trans/closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ fn build_closure(bcx0: @block_ctxt,
417417
vec::iter(cap_vars) { |cap_var|
418418
let lv = trans_local_var(bcx, cap_var.def);
419419
let nid = ast_util::def_id_of_def(cap_var.def).node;
420-
let ty = ty::node_id_to_monotype(tcx, nid);
420+
let ty = ty::node_id_to_type(tcx, nid);
421421
alt cap_var.mode {
422422
capture::cap_ref {
423423
assert ck == ty::ck_block;

branches/snap-stage3/src/comp/middle/trans/impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn trans_impl(cx: @local_ctxt, name: ast::ident, methods: [@ast::method],
4646
alt cx.ccx.item_ids.find(m.id) {
4747
some(llfn) {
4848
trans_fn(extend_path(sub_cx, m.ident), m.span, m.decl, m.body,
49-
llfn, impl_self(ty::node_id_to_monotype(cx.ccx.tcx, id)),
49+
llfn, impl_self(ty::node_id_to_type(cx.ccx.tcx, id)),
5050
tps + m.tps, m.id);
5151
}
5252
}

0 commit comments

Comments
 (0)