Change "pred" to "pure fn" (but still accept "pred")
This is part 1 of changing the "pred" keyword to "pure fn". Right now, the compiler accepts both "pred" and "pure fn".
This commit is contained in:
parent
5b5689d4dd
commit
c6155d1fd1
4 changed files with 11 additions and 7 deletions
|
@ -284,7 +284,7 @@ fn item_family_to_str(fam: u8) -> str {
|
|||
alt fam as char {
|
||||
'c' { ret "const"; }
|
||||
'f' { ret "fn"; }
|
||||
'p' { ret "pred"; }
|
||||
'p' { ret "pure fn"; }
|
||||
'F' { ret "native fn"; }
|
||||
'y' { ret "type"; }
|
||||
'T' { ret "native type"; }
|
||||
|
|
|
@ -371,7 +371,7 @@ type fn_decl =
|
|||
constraints: [@constr]};
|
||||
|
||||
tag purity {
|
||||
pure_fn; // declared with "pred"
|
||||
pure_fn; // declared with "pure fn"
|
||||
impure_fn; // declared with "fn"
|
||||
}
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ fn bad_expr_word_table() -> hashmap<str, ()> {
|
|||
words.insert("fn", ());
|
||||
words.insert("block", ());
|
||||
words.insert("lambda", ());
|
||||
words.insert("pred", ());
|
||||
words.insert("pure", ());
|
||||
words.insert("iter", ());
|
||||
words.insert("block", ());
|
||||
words.insert("import", ());
|
||||
|
@ -326,8 +326,6 @@ fn parse_proto(p: &parser) -> ast::proto {
|
|||
ret ast::proto_fn;
|
||||
} else if eat_word(p, "block") {
|
||||
ret ast::proto_block;
|
||||
} else if eat_word(p, "pred") {
|
||||
ret ast::proto_fn;
|
||||
} else { unexpected(p, p.peek()); }
|
||||
}
|
||||
|
||||
|
@ -2123,7 +2121,13 @@ fn parse_item(p: &parser, attrs: &[ast::attribute]) -> option::t<@ast::item> {
|
|||
p.bump();
|
||||
ret some(parse_item_fn_or_iter(p, ast::impure_fn, ast::proto_fn,
|
||||
attrs, ast::il_normal));
|
||||
} else if eat_word(p, "pred") {
|
||||
} else if eat_word(p, "pure") {
|
||||
expect_word(p, "fn");
|
||||
ret some(parse_item_fn_or_iter(p, ast::pure_fn, ast::proto_fn, attrs,
|
||||
ast::il_normal));
|
||||
}
|
||||
// FIXME: remove
|
||||
else if eat_word(p, "pred") {
|
||||
ret some(parse_item_fn_or_iter(p, ast::pure_fn, ast::proto_fn, attrs,
|
||||
ast::il_normal));
|
||||
} else if eat_word(p, "iter") {
|
||||
|
|
|
@ -1197,7 +1197,7 @@ fn print_fn(s: &ps, decl: ast::fn_decl, proto: ast::proto, name: str,
|
|||
typarams: &[ast::ty_param], constrs: [@ast::constr]) {
|
||||
alt decl.purity {
|
||||
ast::impure_fn. { head(s, proto_to_str(proto)); }
|
||||
_ { head(s, "pred"); }
|
||||
_ { head(s, "pure fn"); }
|
||||
}
|
||||
word(s.s, name);
|
||||
print_type_params(s, typarams);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue