1
Fork 0

Use 'resource' rather than 'res' as a keyword

Resources are now defined like...

    resource fd(int n) { close(n); }

Calling fd with an int will then produce a non-copyable value
that, when dropped, will call close on the given int.
This commit is contained in:
Marijn Haverbeke 2011-06-28 17:53:00 +02:00
parent fb14afd5eb
commit 9561def209
4 changed files with 8 additions and 8 deletions

View file

@ -139,7 +139,7 @@ fn bad_expr_word_table() -> hashmap[str, ()] {
words.insert("be", ());
words.insert("fail", ());
words.insert("type", ());
words.insert("res", ());
words.insert("resource", ());
words.insert("check", ());
words.insert("assert", ());
words.insert("claim", ());
@ -2045,7 +2045,7 @@ fn parse_item(&parser p, vec[ast::attribute] attrs) -> parsed_item {
ret got_item(parse_item_tag(p, attrs));
} else if (eat_word(p, "obj")) {
ret got_item(parse_item_obj(p, lyr, attrs));
} else if (eat_word(p, "res")) {
} else if (eat_word(p, "resource")) {
ret got_item(parse_item_res(p, lyr, attrs));
} else { ret no_item; }
}