Skip to content

Commit 33869c4

Browse files
committed
---
yaml --- r: 3677 b: refs/heads/master c: 0e2fff5 h: refs/heads/master i: 3675: 9fa4d50 v: v3
1 parent af08d6c commit 33869c4

24 files changed

+401
-374
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: bbcbaa6601a56c543f9200ce3bc047c366eff3ed
2+
refs/heads/master: 0e2fff53375eba748b6d6727f69a2560f96bc8ec

trunk/src/comp/front/config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ fn filter_stmt(&ast::crate_cfg cfg,
8282
fn fold_block(&ast::crate_cfg cfg, &ast::block_ b,
8383
fold::ast_fold fld) -> ast::block_ {
8484
auto filter = bind filter_stmt(cfg, _);
85-
auto filtered_stmts = vec::filter_map(filter, b.stmts);
86-
ret rec(stmts=vec::map(fld.fold_stmt, filtered_stmts),
85+
auto filtered_stmts = ivec::filter_map(filter, b.stmts);
86+
ret rec(stmts=ivec::map(fld.fold_stmt, filtered_stmts),
8787
expr=option::map(fld.fold_expr, b.expr),
8888
id=b.id);
8989
}

trunk/src/comp/front/test.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ fn mk_main(&test_ctxt cx) -> @ast::item {
7171
auto ret_ty = @rec(node=ast::ty_nil,
7272
span=rec(lo=0u, hi=0u));
7373

74-
let ast::fn_decl decl = rec(inputs = [],
74+
let ast::fn_decl decl = rec(inputs = ~[],
7575
output = ret_ty,
7676
purity = ast::impure_fn,
7777
cf = ast::return,
7878
constraints = ~[]);
7979
auto proto = ast::proto_fn;
8080

81-
let ast::block_ body_ = rec(stmts = [],
81+
let ast::block_ body_ = rec(stmts = ~[],
8282
expr = option::none,
8383
id = cx.next_node_id());
8484
auto body = rec(node = body_, span = rec(lo=0u, hi=0u));
@@ -87,7 +87,7 @@ fn mk_main(&test_ctxt cx) -> @ast::item {
8787
proto = proto,
8888
body = body);
8989

90-
auto item_ = ast::item_fn(fn_, []);
90+
auto item_ = ast::item_fn(fn_, ~[]);
9191
let ast::item item = rec(ident = "main",
9292
attrs = ~[],
9393
id = cx.next_node_id(),

trunk/src/comp/metadata/encoder.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Metadata encoding
22

3+
import std::ivec;
34
import std::str;
45
import std::vec;
56
import std::uint;
@@ -33,7 +34,7 @@ fn encode_def_id(&ebml::writer ebml_w, &def_id id) {
3334
ebml::end_tag(ebml_w);
3435
}
3536

36-
fn encode_tag_variant_paths(&ebml::writer ebml_w, &vec[variant] variants,
37+
fn encode_tag_variant_paths(&ebml::writer ebml_w, &variant[] variants,
3738
&vec[str] path,
3839
&mutable vec[tup(str, uint)] index) {
3940
for (variant variant in variants) {
@@ -164,9 +165,9 @@ fn encode_kind(&ebml::writer ebml_w, u8 c) {
164165

165166
fn def_to_str(&def_id did) -> str { ret #fmt("%d:%d", did._0, did._1); }
166167

167-
fn encode_type_param_count(&ebml::writer ebml_w, &vec[ty_param] tps) {
168+
fn encode_type_param_count(&ebml::writer ebml_w, &ty_param[] tps) {
168169
ebml::start_tag(ebml_w, tag_items_data_item_ty_param_count);
169-
ebml::write_vint(ebml_w.writer, vec::len[ty_param](tps));
170+
ebml::write_vint(ebml_w.writer, ivec::len[ty_param](tps));
170171
ebml::end_tag(ebml_w);
171172
}
172173

@@ -207,9 +208,9 @@ fn encode_tag_id(&ebml::writer ebml_w, &def_id id) {
207208
}
208209

209210
fn encode_tag_variant_info(&@crate_ctxt cx, &ebml::writer ebml_w,
210-
node_id id, &vec[variant] variants,
211+
node_id id, &variant[] variants,
211212
&mutable vec[tup(int, uint)] index,
212-
&vec[ty_param] ty_params) {
213+
&ty_param[] ty_params) {
213214
for (variant variant in variants) {
214215
index += [tup(variant.node.id, ebml_w.writer.tell())];
215216
ebml::start_tag(ebml_w, tag_items_data_item);

trunk/src/comp/middle/alias.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn check_crate(@ty::ctxt tcx, &@ast::crate crate) {
5353
tcx.sess.abort_if_errors();
5454
}
5555

56-
fn visit_fn(@ctx cx, &ast::_fn f, &vec[ast::ty_param] tp, &span sp,
56+
fn visit_fn(@ctx cx, &ast::_fn f, &ast::ty_param[] tp, &span sp,
5757
&fn_ident name, ast::node_id id, &scope sc, &vt[scope] v) {
5858
visit::visit_fn_decl(f.decl, sc, v);
5959
for (ast::arg arg_ in f.decl.inputs) {
@@ -132,7 +132,7 @@ fn visit_expr(@ctx cx, &@ast::expr ex, &scope sc, &vt[scope] v) {
132132
if (!handled) { visit::visit_expr(ex, sc, v); }
133133
}
134134

135-
fn check_call(&ctx cx, &@ast::expr f, &vec[@ast::expr] args, &scope sc) ->
135+
fn check_call(&ctx cx, &@ast::expr f, &(@ast::expr)[] args, &scope sc) ->
136136
rec(vec[node_id] root_vars, vec[ty::t] unsafe_ts) {
137137
auto fty = ty::expr_ty(*cx.tcx, f);
138138
auto arg_ts = fty_args(cx, fty);
@@ -261,7 +261,7 @@ fn check_tail_call(&ctx cx, &@ast::expr call) {
261261
}
262262
}
263263

264-
fn check_alt(&ctx cx, &@ast::expr input, &vec[ast::arm] arms, &scope sc,
264+
fn check_alt(&ctx cx, &@ast::expr input, &ast::arm[] arms, &scope sc,
265265
&vt[scope] v) {
266266
visit::visit_expr(input, sc, v);
267267
auto root = expr_root(cx, input, true);

trunk/src/comp/middle/resolve.rs

+24-13
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export crate_map;
4747
tag scope {
4848
scope_crate(@ast::crate);
4949
scope_item(@ast::item);
50-
scope_fn(ast::fn_decl, vec[ast::ty_param]);
50+
scope_fn(ast::fn_decl, ast::ty_param[]);
5151
scope_native_item(@ast::native_item);
5252
scope_loop(@ast::local); // there's only 1 decl per loop.
5353
scope_block(ast::block);
@@ -346,7 +346,7 @@ fn visit_native_item_with_scope(&@ast::native_item ni, &scopes sc,
346346
visit::visit_native_item(ni, cons(scope_native_item(ni), @sc), v);
347347
}
348348

349-
fn visit_fn_with_scope(&@env e, &ast::_fn f, &vec[ast::ty_param] tp, &span sp,
349+
fn visit_fn_with_scope(&@env e, &ast::_fn f, &ast::ty_param[] tp, &span sp,
350350
&fn_ident name, node_id id, &scopes sc,
351351
&vt[scopes] v) {
352352
// here's where we need to set up the mapping
@@ -376,7 +376,7 @@ fn visit_expr_with_scope(&@ast::expr x, &scopes sc, &vt[scopes] v) {
376376
case (ast::expr_for_each(?d, _, _)) {
377377
cons[scope](scope_loop(d), @sc)
378378
}
379-
case (ast::expr_fn(?f)) { cons(scope_fn(f.decl, []), @sc) }
379+
case (ast::expr_fn(?f)) { cons(scope_fn(f.decl, ~[]), @sc) }
380380
case (_) { sc }
381381
};
382382
visit::visit_expr(x, new_sc, v);
@@ -638,8 +638,7 @@ fn lookup_in_scope(&env e, scopes sc, &span sp, &ident name, namespace ns) ->
638638
}
639639
case (scope_native_item(?it)) {
640640
alt (it.node) {
641-
case (ast::native_item_fn(_, ?decl, ?ty_params))
642-
{
641+
case (ast::native_item_fn(_, ?decl, ?ty_params)) {
643642
ret lookup_in_fn(name, decl, ty_params, ns);
644643
}
645644
}
@@ -690,7 +689,7 @@ fn lookup_in_scope(&env e, scopes sc, &span sp, &ident name, namespace ns) ->
690689

691690
}
692691

693-
fn lookup_in_ty_params(&ident name, &vec[ast::ty_param] ty_params) ->
692+
fn lookup_in_ty_params(&ident name, &ast::ty_param[] ty_params) ->
694693
option::t[def] {
695694
auto i = 0u;
696695
for (ast::ty_param tp in ty_params) {
@@ -720,7 +719,7 @@ fn lookup_in_pat(&ident name, &ast::pat pat) -> option::t[def] {
720719
}
721720

722721
fn lookup_in_fn(&ident name, &ast::fn_decl decl,
723-
&vec[ast::ty_param] ty_params,
722+
&ast::ty_param[] ty_params,
724723
namespace ns) -> option::t[def] {
725724
alt (ns) {
726725
case (ns_value) {
@@ -736,7 +735,7 @@ fn lookup_in_fn(&ident name, &ast::fn_decl decl,
736735
}
737736
}
738737

739-
fn lookup_in_obj(&ident name, &ast::_obj ob, &vec[ast::ty_param] ty_params,
738+
fn lookup_in_obj(&ident name, &ast::_obj ob, &ast::ty_param[] ty_params,
740739
namespace ns) -> option::t[def] {
741740
alt (ns) {
742741
case (ns_value) {
@@ -1229,18 +1228,22 @@ fn check_item(@env e, &@ast::item i, &() x, &vt[()] v) {
12291228
alt (i.node) {
12301229
case (ast::item_fn(?f, ?ty_params)) {
12311230
check_fn(*e, i.span, f);
1232-
ensure_unique(*e, i.span, ty_params, ident_id, "type parameter");
1231+
ensure_unique_ivec(*e, i.span, ty_params, ident_id,
1232+
"type parameter");
12331233
}
12341234
case (ast::item_obj(?ob, ?ty_params, _)) {
12351235
fn field_name(&ast::obj_field field) -> ident { ret field.ident; }
1236-
ensure_unique(*e, i.span, ob.fields, field_name, "object field");
1236+
ensure_unique_ivec(*e, i.span, ob.fields, field_name,
1237+
"object field");
12371238
for (@ast::method m in ob.methods) {
12381239
check_fn(*e, m.span, m.node.meth);
12391240
}
1240-
ensure_unique(*e, i.span, ty_params, ident_id, "type parameter");
1241+
ensure_unique_ivec(*e, i.span, ty_params, ident_id,
1242+
"type parameter");
12411243
}
12421244
case (ast::item_tag(_, ?ty_params)) {
1243-
ensure_unique(*e, i.span, ty_params, ident_id, "type parameter");
1245+
ensure_unique_ivec(*e, i.span, ty_params, ident_id,
1246+
"type parameter");
12441247
}
12451248
case (_) { }
12461249
}
@@ -1315,7 +1318,7 @@ fn check_block(@env e, &ast::block b, &() x, &vt[()] v) {
13151318

13161319
fn check_fn(&env e, &span sp, &ast::_fn f) {
13171320
fn arg_name(&ast::arg a) -> ident { ret a.ident; }
1318-
ensure_unique(e, sp, f.decl.inputs, arg_name, "argument");
1321+
ensure_unique_ivec(e, sp, f.decl.inputs, arg_name, "argument");
13191322
}
13201323

13211324
type checker = @rec(mutable vec[ident] seen, str kind, session sess);
@@ -1341,6 +1344,14 @@ fn ensure_unique[T](&env e, &span sp, &vec[T] elts, fn(&T) -> ident id,
13411344
auto ch = checker(e, kind);
13421345
for (T elt in elts) { add_name(ch, sp, id(elt)); }
13431346
}
1347+
1348+
// FIXME: Remove me.
1349+
fn ensure_unique_ivec[T](&env e, &span sp, &T[] elts, fn(&T) -> ident id,
1350+
&str kind) {
1351+
auto ch = checker(e, kind);
1352+
for (T elt in elts) { add_name(ch, sp, id(elt)); }
1353+
}
1354+
13441355
// Local Variables:
13451356
// mode: rust
13461357
// fill-column: 78;

0 commit comments

Comments
 (0)