Skip to content

Commit dd81110

Browse files
committed
---
yaml --- r: 3662 b: refs/heads/master c: c83782f h: refs/heads/master v: v3
1 parent e62faf6 commit dd81110

File tree

4 files changed

+33
-13
lines changed

4 files changed

+33
-13
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: aad0bcc8d5e1ed9cf6ca0eedae21b3aa0c67ab16
2+
refs/heads/master: c83782f5008b366191ddf8f6f820b49a23eaadcd

trunk/src/comp/syntax/ast.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ type ty_arg_ = rec(mode mode, @ty ty);
334334
type ty_method_ =
335335
rec(proto proto,
336336
ident ident,
337-
vec[ty_arg] inputs,
337+
ty_arg[] inputs,
338338
@ty output,
339339
controlflow cf,
340340
vec[@constr] constrs);
@@ -402,9 +402,9 @@ tag ty_ {
402402
ty_port(@ty);
403403
ty_chan(@ty);
404404
ty_tup(mt[]);
405-
ty_rec(vec[ty_field]);
406-
ty_fn(proto, vec[ty_arg], @ty, controlflow, vec[@constr]);
407-
ty_obj(vec[ty_method]);
405+
ty_rec(ty_field[]);
406+
ty_fn(proto, ty_arg[], @ty, controlflow, vec[@constr]);
407+
ty_obj(ty_method[]);
408408
ty_path(path, node_id);
409409
ty_type;
410410
ty_constr(@ty, vec[@constr]);

trunk/src/comp/syntax/parse/parser.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ fn parse_ty_fn(ast::proto proto, &parser p, uint lo) -> ast::ty_ {
258258
}
259259
auto lo = p.get_lo_pos();
260260
auto inputs =
261-
parse_seq(token::LPAREN, token::RPAREN, some(token::COMMA),
262-
parse_fn_input_ty, p);
261+
parse_seq_ivec(token::LPAREN, token::RPAREN, some(token::COMMA),
262+
parse_fn_input_ty, p);
263263
auto constrs = parse_constrs([], p);
264264
let @ast::ty output;
265265
auto cf = ast::return;
@@ -308,7 +308,7 @@ fn parse_ty_obj(&parser p, &mutable uint hi) -> ast::ty_ {
308308
fail;
309309
}
310310
auto f = parse_method_sig;
311-
auto meths = parse_seq(token::LBRACE, token::RBRACE, none, f, p);
311+
auto meths = parse_seq_ivec(token::LBRACE, token::RBRACE, none, f, p);
312312
hi = meths.span.hi;
313313
ret ast::ty_obj(meths.node);
314314
}
@@ -526,8 +526,8 @@ fn parse_ty(&parser p) -> @ast::ty {
526526
t = ast::ty_tup(elems.node);
527527
} else if (eat_word(p, "rec")) {
528528
auto elems =
529-
parse_seq(token::LPAREN, token::RPAREN, some(token::COMMA),
530-
parse_ty_field, p);
529+
parse_seq_ivec(token::LPAREN, token::RPAREN, some(token::COMMA),
530+
parse_ty_field, p);
531531
hi = elems.span.hi;
532532
t = ast::ty_rec(elems.node);
533533
} else if (eat_word(p, "fn")) {

trunk/src/comp/syntax/print/pprust.rs

+23-3
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,26 @@ fn commasep_cmnt[IN](&ps s, breaks b, vec[IN] elts, fn(&ps, &IN) op,
237237
end(s);
238238
}
239239

240+
// TODO: Remove me.
241+
fn commasep_cmnt_ivec[IN](&ps s, breaks b, &IN[] elts, fn(&ps, &IN) op,
242+
fn(&IN) -> codemap::span get_span) {
243+
box(s, 0u, b);
244+
auto len = ivec::len[IN](elts);
245+
auto i = 0u;
246+
for (IN elt in elts) {
247+
maybe_print_comment(s, get_span(elt).hi);
248+
op(s, elt);
249+
i += 1u;
250+
if (i < len) {
251+
word(s.s, ",");
252+
maybe_print_trailing_comment(s, get_span(elt),
253+
some(get_span(elts.(i)).hi));
254+
space_if_not_hardbreak(s);
255+
}
256+
}
257+
end(s);
258+
}
259+
240260
fn commasep_exprs(&ps s, breaks b, vec[@ast::expr] exprs) {
241261
fn expr_span(&@ast::expr expr) -> codemap::span { ret expr.span; }
242262
commasep_cmnt(s, b, exprs, print_expr, expr_span);
@@ -315,7 +335,7 @@ fn print_type(&ps s, &ast::ty ty) {
315335
end(s);
316336
}
317337
fn get_span(&ast::ty_field f) -> codemap::span { ret f.span; }
318-
commasep_cmnt(s, consistent, fields, print_field, get_span);
338+
commasep_cmnt_ivec(s, consistent, fields, print_field, get_span);
319339
pclose(s);
320340
}
321341
case (ast::ty_fn(?proto, ?inputs, ?output, ?cf, ?constrs)) {
@@ -1214,7 +1234,7 @@ fn print_mt(&ps s, &ast::mt mt) {
12141234
}
12151235

12161236
fn print_ty_fn(&ps s, &ast::proto proto, &option::t[str] id,
1217-
&vec[ast::ty_arg] inputs, &@ast::ty output,
1237+
&ast::ty_arg[] inputs, &@ast::ty output,
12181238
&ast::controlflow cf, &vec[@ast::constr] constrs) {
12191239
ibox(s, indent_unit);
12201240
if (proto == ast::proto_fn) {
@@ -1230,7 +1250,7 @@ fn print_ty_fn(&ps s, &ast::proto proto, &option::t[str] id,
12301250
print_alias(s, input.node.mode);
12311251
print_type(s, *input.node.ty);
12321252
}
1233-
commasep(s, inconsistent, inputs, print_arg);
1253+
commasep_ivec(s, inconsistent, inputs, print_arg);
12341254
pclose(s);
12351255
maybe_print_comment(s, output.span.lo);
12361256
if (output.node != ast::ty_nil) {

0 commit comments

Comments
 (0)