expand purity to include unsafe

This commit is contained in:
Niko Matsakis 2011-10-06 15:29:54 -07:00 committed by Brian Anderson
parent 9476692b52
commit 58b8e88356
4 changed files with 29 additions and 18 deletions

View file

@ -165,6 +165,7 @@ fn bad_expr_word_table() -> hashmap<str, ()> {
words.insert("fn", ());
words.insert("lambda", ());
words.insert("pure", ());
words.insert("unsafe", ());
words.insert("iter", ());
words.insert("block", ());
words.insert("import", ());
@ -2153,6 +2154,10 @@ fn parse_item(p: parser, attrs: [ast::attribute]) -> option::t<@ast::item> {
let proto = parse_fn_proto(p);
ret some(parse_item_fn_or_iter(p, ast::pure_fn, proto, attrs,
ast::il_normal));
} else if eat_word(p, "unsafe") {
expect_word(p, "fn");
ret some(parse_item_fn_or_iter(p, ast::unsafe_fn, ast::proto_fn,
attrs, ast::il_normal));
} else if eat_word(p, "iter") {
ret some(parse_item_fn_or_iter(p, ast::impure_fn, ast::proto_iter,
attrs, ast::il_normal));