Skip to content

Commit c3ce433

Browse files
committed
---
yaml --- r: 11410 b: refs/heads/master c: e57b677 h: refs/heads/master v: v3
1 parent 30fb56b commit c3ce433

File tree

4 files changed

+28
-52
lines changed

4 files changed

+28
-52
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 40cd1a7c455afc55be01a988ae0c55f3d07fbcf5
2+
refs/heads/master: e57b6775c3a2d9dbe7fae69c189b8ae9032315cb
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/comp/syntax/ext/simplext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ fn p_t_s_rec(cx: ext_ctxt, m: matchable, s: selector, b: binders) {
459459
}
460460
}
461461
}
462-
/* TODO: handle embedded types and blocks, at least */
462+
/* FIXME: handle embedded types and blocks, at least */
463463
expr_mac(mac) {
464464
p_t_s_r_mac(cx, mac, s, b);
465465
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,7 +1581,7 @@ fn parse_local(p: parser, allow_init: bool) -> @ast::local {
15811581

15821582
fn parse_let(p: parser) -> @ast::decl {
15831583
if eat_word(p, "mut") {
1584-
/* TODO */
1584+
/* FIXME */
15851585
}
15861586
let lo = p.span.lo;
15871587
let locals = [parse_local(p, true)];
@@ -2027,7 +2027,7 @@ enum class_contents { ctor_decl(ast::fn_decl, ast::blk),
20272027
let body = parse_block(p);
20282028
ret ctor_decl(decl, body);
20292029
}
2030-
// TODO: refactor
2030+
// FIXME: refactor
20312031
else if eat_word(p, "priv") {
20322032
expect(p, token::LBRACE);
20332033
let results = [];

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

Lines changed: 24 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import pp::{break_offset, word, printer,
88
import driver::diagnostic;
99

1010
// The ps is stored here to prevent recursive type.
11-
// FIXME use a nominal enum instead
1211
enum ann_node {
1312
node_block(ps, ast::blk),
1413
node_item(ps, @ast::item),
@@ -357,7 +356,7 @@ fn print_type(s: ps, &&ty: @ast::ty) {
357356
ast::ty_constr(t, cs) {
358357
print_type(s, t);
359358
space(s.s);
360-
word(s.s, ast_ty_constrs_str(cs));
359+
word(s.s, constrs_str(cs, ty_constr_to_str));
361360
}
362361
ast::ty_mac(_) {
363362
fail "print_type doesn't know how to print a ty_mac";
@@ -482,7 +481,7 @@ fn print_item(s: ps, &&item: @ast::item) {
482481
print_block(s, ctor_body);
483482
for ci in items {
484483
/*
485-
TODO: collect all private items and print them
484+
FIXME: collect all private items and print them
486485
in a single "priv" section
487486
*/
488487
hardbreak_if_not_bol(s);
@@ -1249,7 +1248,10 @@ fn print_fn_args_and_ret(s: ps, decl: ast::fn_decl) {
12491248
}
12501249
commasep(s, inconsistent, decl.inputs, print_arg);
12511250
pclose(s);
1252-
word(s.s, ast_fn_constrs_str(decl, decl.constraints));
1251+
word(s.s, constrs_str(decl.constraints, {|c|
1252+
ast_fn_constr_to_str(decl, c)
1253+
}));
1254+
12531255
maybe_print_comment(s, decl.output.span.lo);
12541256
if decl.output.node != ast::ty_nil {
12551257
space_if_not_bol(s);
@@ -1479,7 +1481,7 @@ fn print_ty_fn(s: ps, opt_proto: option<ast::proto>,
14791481
else { print_type(s, decl.output); }
14801482
end(s);
14811483
}
1482-
word(s.s, ast_ty_fn_constrs_str(decl.constraints));
1484+
word(s.s, constrs_str(decl.constraints, ast_ty_fn_constr_to_str));
14831485
end(s);
14841486
}
14851487

@@ -1684,8 +1686,6 @@ fn next_comment(s: ps) -> option<lexer::cmnt> {
16841686
}
16851687
}
16861688

1687-
// Removing the aliases from the type of f in the next two functions
1688-
// triggers memory corruption, but I haven't isolated the bug yet. FIXME
16891689
fn constr_args_to_str<T>(f: fn@(T) -> str, args: [@ast::sp_constr_arg<T>]) ->
16901690
str {
16911691
let comma = false;
@@ -1712,43 +1712,38 @@ fn constr_arg_to_str<T>(f: fn@(T) -> str, c: ast::constr_arg_general_<T>) ->
17121712
// (argh)
17131713
fn uint_to_str(&&i: uint) -> str { ret uint::str(i); }
17141714

1715-
fn ast_ty_fn_constr_to_str(c: @ast::constr) -> str {
1715+
fn ast_ty_fn_constr_to_str(&&c: @ast::constr) -> str {
17161716
ret path_to_str(c.node.path) +
17171717
constr_args_to_str(uint_to_str, c.node.args);
17181718
}
17191719

1720-
// FIXME: fix repeated code
1721-
fn ast_ty_fn_constrs_str(constrs: [@ast::constr]) -> str {
1722-
let s = "";
1723-
let colon = true;
1724-
for c: @ast::constr in constrs {
1725-
if colon { s += " : "; colon = false; } else { s += ", "; }
1726-
s += ast_ty_fn_constr_to_str(c);
1727-
}
1728-
ret s;
1720+
fn ast_fn_constr_to_str(decl: ast::fn_decl, &&c: @ast::constr) -> str {
1721+
let arg_to_str = bind fn_arg_idx_to_str(decl, _);
1722+
ret path_to_str(c.node.path) +
1723+
constr_args_to_str(arg_to_str, c.node.args);
17291724
}
17301725

1731-
fn fn_arg_idx_to_str(decl: ast::fn_decl, &&idx: uint) -> str {
1732-
decl.inputs[idx].ident
1733-
}
1726+
fn ty_constr_to_str(&&c: @ast::ty_constr) -> str {
1727+
fn ty_constr_path_to_str(&&p: @ast::path) -> str { "*." + path_to_str(p) }
17341728

1735-
fn ast_fn_constr_to_str(decl: ast::fn_decl, c: @ast::constr) -> str {
1736-
let arg_to_str = bind fn_arg_idx_to_str(decl, _);
17371729
ret path_to_str(c.node.path) +
1738-
constr_args_to_str(arg_to_str, c.node.args);
1730+
constr_args_to_str::<@ast::path>(ty_constr_path_to_str,
1731+
c.node.args);
17391732
}
17401733

1741-
// FIXME: fix repeated code
1742-
fn ast_fn_constrs_str(decl: ast::fn_decl, constrs: [@ast::constr]) -> str {
1743-
let s = "";
1744-
let colon = true;
1745-
for c: @ast::constr in constrs {
1734+
fn constrs_str<T>(constrs: [T], elt: fn(T) -> str) -> str {
1735+
let s = "", colon = true;
1736+
for c in constrs {
17461737
if colon { s += " : "; colon = false; } else { s += ", "; }
1747-
s += ast_fn_constr_to_str(decl, c);
1738+
s += elt(c);
17481739
}
17491740
ret s;
17501741
}
17511742

1743+
fn fn_arg_idx_to_str(decl: ast::fn_decl, &&idx: uint) -> str {
1744+
decl.inputs[idx].ident
1745+
}
1746+
17521747
fn opt_proto_to_str(opt_p: option<ast::proto>) -> str {
17531748
alt opt_p {
17541749
none { "fn" }
@@ -1766,25 +1761,6 @@ fn proto_to_str(p: ast::proto) -> str {
17661761
};
17671762
}
17681763

1769-
fn ty_constr_to_str(c: @ast::ty_constr) -> str {
1770-
fn ty_constr_path_to_str(&&p: @ast::path) -> str { "*." + path_to_str(p) }
1771-
1772-
ret path_to_str(c.node.path) +
1773-
constr_args_to_str::<@ast::path>(ty_constr_path_to_str,
1774-
c.node.args);
1775-
}
1776-
1777-
1778-
fn ast_ty_constrs_str(constrs: [@ast::ty_constr]) -> str {
1779-
let s = "";
1780-
let colon = true;
1781-
for c: @ast::ty_constr in constrs {
1782-
if colon { s += " : "; colon = false; } else { s += ", "; }
1783-
s += ty_constr_to_str(c);
1784-
}
1785-
ret s;
1786-
}
1787-
17881764
fn ends_in_lit_int(ex: @ast::expr) -> bool {
17891765
alt ex.node {
17901766
ast::expr_lit(@{node: ast::lit_int(_, ast::ty_i), _}) { true }

0 commit comments

Comments
 (0)