Skip to content

Commit 276f1bd

Browse files
committed
---
yaml --- r: 3614 b: refs/heads/master c: 52a7c2b h: refs/heads/master v: v3
1 parent 389f889 commit 276f1bd

File tree

5 files changed

+50
-46
lines changed

5 files changed

+50
-46
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 75c5f9bdba8ca83dd4897d56051e42b928c2a571
2+
refs/heads/master: 52a7c2b78ebd3ee8ee98f0550e78db5fd6702368

trunk/src/comp/metadata/tydecode.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ fn parse_ty(@pstate st, str_def sd) -> ty::t {
227227
}
228228
case ('O') {
229229
assert (next(st) as char == '[');
230-
let vec[ty::method] methods = [];
230+
let ty::method[] methods = ~[];
231231
while (peek(st) as char != ']') {
232232
auto proto;
233233
alt (next(st) as char) {
@@ -240,12 +240,12 @@ fn parse_ty(@pstate st, str_def sd) -> ty::t {
240240
}
241241
auto func = parse_ty_fn(st, sd);
242242
methods +=
243-
[rec(proto=proto,
244-
ident=name,
245-
inputs=func._0,
246-
output=func._1,
247-
cf=func._2,
248-
constrs=func._3)];
243+
~[rec(proto=proto,
244+
ident=name,
245+
inputs=func._0,
246+
output=func._1,
247+
cf=func._2,
248+
constrs=func._3)];
249249
}
250250
st.pos += 1u;
251251
ret ty::mk_obj(st.tcx, methods);

trunk/src/comp/middle/ty.rs

+22-22
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ tag sty {
269269
ty_rec(field[]);
270270
ty_fn(ast::proto, arg[], t, controlflow, (@constr_def)[]);
271271
ty_native_fn(ast::native_abi, arg[], t);
272-
ty_obj(vec[method]);
272+
ty_obj(method[]);
273273
ty_res(def_id, t, t[]);
274274
ty_var(int); // type variable
275275
ty_param(uint); // fn/tag type param
@@ -604,7 +604,7 @@ fn mk_native_fn(&ctxt cx, &ast::native_abi abi, &arg[] args, &t ty) -> t {
604604
ret gen_ty(cx, ty_native_fn(abi, args, ty));
605605
}
606606

607-
fn mk_obj(&ctxt cx, &vec[method] meths) -> t {
607+
fn mk_obj(&ctxt cx, &method[] meths) -> t {
608608
ret gen_ty(cx, ty_obj(meths));
609609
}
610610

@@ -799,20 +799,20 @@ fn fold_ty(&ctxt cx, fold_mode fld, t ty_0) -> t {
799799
fold_ty(cx, fld, ret_ty)), ty);
800800
}
801801
case (ty_obj(?methods)) {
802-
let vec[method] new_methods = [];
802+
let method[] new_methods = ~[];
803803
for (method m in methods) {
804804
let arg[] new_args = ~[];
805805
for (arg a in m.inputs) {
806806
new_args += ~[rec(mode=a.mode,
807807
ty=fold_ty(cx, fld, a.ty))];
808808
}
809809
new_methods +=
810-
[rec(proto=m.proto,
811-
ident=m.ident,
812-
inputs=new_args,
813-
output=fold_ty(cx, fld, m.output),
814-
cf=m.cf,
815-
constrs=m.constrs)];
810+
~[rec(proto=m.proto,
811+
ident=m.ident,
812+
inputs=new_args,
813+
output=fold_ty(cx, fld, m.output),
814+
cf=m.cf,
815+
constrs=m.constrs)];
816816
}
817817
ty = copy_cname(cx, mk_obj(cx, new_methods), ty);
818818
}
@@ -1634,8 +1634,8 @@ fn equal_type_structures(&sty a, &sty b) -> bool {
16341634
case (ty_obj(?methods_a)) {
16351635
alt (b) {
16361636
case (ty_obj(?methods_b)) {
1637-
auto len = vec::len[method](methods_a);
1638-
if (len != vec::len[method](methods_b)) { ret false; }
1637+
auto len = ivec::len[method](methods_a);
1638+
if (len != ivec::len[method](methods_b)) { ret false; }
16391639
auto i = 0u;
16401640
while (i < len) {
16411641
auto m_a = methods_a.(i);
@@ -1941,17 +1941,17 @@ fn field_idx(&session::session sess, &span sp, &ast::ident id,
19411941
}
19421942

19431943
fn method_idx(&session::session sess, &span sp, &ast::ident id,
1944-
&vec[method] meths) -> uint {
1944+
&method[] meths) -> uint {
19451945
let uint i = 0u;
19461946
for (method m in meths) { if (str::eq(m.ident, id)) { ret i; } i += 1u; }
19471947
sess.span_fatal(sp, "unknown method '" + id + "' of obj");
19481948
}
19491949

1950-
fn sort_methods(&vec[method] meths) -> vec[method] {
1950+
fn sort_methods(&method[] meths) -> method[] {
19511951
fn method_lteq(&method a, &method b) -> bool {
19521952
ret str::lteq(a.ident, b.ident);
19531953
}
1954-
ret std::sort::merge_sort[method](bind method_lteq(_, _), meths);
1954+
ret std::sort::ivector::merge_sort[method](bind method_lteq(_, _), meths);
19551955
}
19561956

19571957
fn is_lval(&@ast::expr expr) -> bool {
@@ -2191,12 +2191,12 @@ mod unify {
21912191
}
21922192
}
21932193
fn unify_obj(&@ctxt cx, &t expected, &t actual,
2194-
&vec[method] expected_meths, &vec[method] actual_meths) ->
2194+
&method[] expected_meths, &method[] actual_meths) ->
21952195
result {
2196-
let vec[method] result_meths = [];
2196+
let method[] result_meths = ~[];
21972197
let uint i = 0u;
2198-
let uint expected_len = vec::len[method](expected_meths);
2199-
let uint actual_len = vec::len[method](actual_meths);
2198+
let uint expected_len = ivec::len[method](expected_meths);
2199+
let uint actual_len = ivec::len[method](actual_meths);
22002200
if (expected_len != actual_len) { ret ures_err(terr_meth_count); }
22012201
while (i < expected_len) {
22022202
auto e_meth = expected_meths.(i);
@@ -2214,10 +2214,10 @@ mod unify {
22142214
alt (struct(cx.tcx, tfn)) {
22152215
case (ty_fn(?proto, ?ins, ?out, ?cf, ?constrs)) {
22162216
result_meths +=
2217-
[rec(inputs=ins,
2218-
output=out,
2219-
cf=cf,
2220-
constrs=constrs with e_meth)];
2217+
~[rec(inputs=ins,
2218+
output=out,
2219+
cf=cf,
2220+
constrs=constrs with e_meth)];
22212221
}
22222222
}
22232223
}

trunk/src/comp/middle/typeck.rs

+16-13
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ fn ast_ty_to_ty(&ty::ctxt tcx, &ty_getter getter, &@ast::ty ast_ty) -> ty::t {
364364
cname = some(path_to_str(path));
365365
}
366366
case (ast::ty_obj(?meths)) {
367-
let vec[ty::method] tmeths = [];
367+
let ty::method[] tmeths = ~[];
368368
for (ast::ty_method m in meths) {
369369
auto ins = ~[];
370370
for (ast::ty_arg ta in m.node.inputs) {
@@ -383,7 +383,7 @@ fn ast_ty_to_ty(&ty::ctxt tcx, &ty_getter getter, &@ast::ty ast_ty) -> ty::t {
383383
output=out,
384384
cf=m.node.cf,
385385
constrs=out_constrs);
386-
vec::push[ty::method](tmeths, new_m);
386+
tmeths += ~[new_m];
387387
}
388388
typ = ty::mk_obj(tcx, ty::sort_methods(tmeths));
389389
}
@@ -717,9 +717,12 @@ mod collect {
717717
write::ty_only(cx.tcx, variant.node.id, result_ty);
718718
}
719719
}
720-
fn get_obj_method_types(&@ctxt cx, &ast::_obj object) -> vec[ty::method] {
721-
ret vec::map[@ast::method,
722-
method](bind ty_of_method(cx, _), object.methods);
720+
fn get_obj_method_types(&@ctxt cx, &ast::_obj object) -> ty::method[] {
721+
auto meths = ~[];
722+
for (@ast::method m in object.methods) {
723+
meths += ~[ty_of_method(cx, m)];
724+
}
725+
ret meths;
723726
}
724727
fn convert(@ctxt cx, @mutable option::t[ast::native_abi] abi,
725728
&@ast::item it) {
@@ -2133,7 +2136,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
21332136
let uint ix =
21342137
ty::method_idx(fcx.ccx.tcx.sess, expr.span, field,
21352138
methods);
2136-
if (ix >= vec::len[ty::method](methods)) {
2139+
if (ix >= ivec::len[ty::method](methods)) {
21372140
fcx.ccx.tcx.sess.span_fatal(expr.span,
21382141
"bad index on obj");
21392142
}
@@ -2267,21 +2270,21 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
22672270
constrs=out_constrs);
22682271
}
22692272
fn get_anon_obj_method_types(@fn_ctxt fcx,
2270-
&ast::anon_obj anon_obj) ->
2271-
vec[ty::method] {
2273+
&ast::anon_obj anon_obj)
2274+
-> ty::method[] {
22722275

2273-
let vec[ty::method] methods = [];
2276+
let ty::method[] methods = ~[];
22742277

22752278
// Outer methods.
2276-
methods += vec::map[@ast::method,
2277-
method](bind ty_of_method(fcx.ccx, _),
2278-
anon_obj.methods);
2279+
for (@ast::method m in anon_obj.methods) {
2280+
methods += ~[ty_of_method(fcx.ccx, m)];
2281+
}
22792282

22802283
// Inner methods.
22812284

22822285
// Typecheck 'with_obj'. If it exists, it had better have
22832286
// object type.
2284-
let vec[ty::method] with_obj_methods = [];
2287+
let ty::method[] with_obj_methods = ~[];
22852288
alt (anon_obj.with_obj) {
22862289
case (none) { }
22872290
case (some(?e)) {

trunk/src/comp/util/ppaux.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,10 @@ fn ty_to_str(&ctxt cx, &t typ) -> str {
133133
ast::return, ~[]);
134134
}
135135
case (ty_obj(?meths)) {
136-
auto f = bind method_to_str(cx, _);
137-
auto m = vec::map[method, str](f, meths);
138-
s += "obj {\n\t" + str::connect(m, "\n\t") + "\n}";
136+
// TODO: Remove this ivec->vec conversion.
137+
auto strs = [];
138+
for (method m in meths) { strs += [method_to_str(cx, m)]; }
139+
s += "obj {\n\t" + str::connect(strs, "\n\t") + "\n}";
139140
}
140141
case (ty_res(?id, _, _)) {
141142
s += "<resource#" + int::str(id._0) + ":" + int::str(id._1) + ">";

0 commit comments

Comments
 (0)