1
Fork 0

syntax: Make 'true' and 'false' bad words

When these are idents they are always shadowed by the boolean
constants.
This commit is contained in:
Brian Anderson 2012-04-24 21:47:22 -07:00
parent 98ac8d4625
commit 08d0707556
3 changed files with 7 additions and 5 deletions

View file

@ -213,7 +213,6 @@ fn keyword_table() -> hashmap<str, ()> {
"as", "as",
"bind", "bind",
"else", "else",
"false",
"implements", "implements",
"move", "move",
"of", "of",
@ -222,7 +221,6 @@ fn keyword_table() -> hashmap<str, ()> {
"send", "send",
"static", "static",
"to", "to",
"true",
"use", "use",
"with" "with"
]; ];
@ -241,9 +239,9 @@ fn bad_expr_word_table() -> hashmap<str, ()> {
let words = str_hash(); let words = str_hash();
let keys = ["alt", "assert", "be", "break", "check", "claim", let keys = ["alt", "assert", "be", "break", "check", "claim",
"class", "const", "cont", "copy", "crust", "do", "else", "class", "const", "cont", "copy", "crust", "do", "else",
"enum", "export", "fail", "fn", "for", "if", "iface", "enum", "export", "fail", "false", "fn", "for", "if",
"impl", "import", "let", "log", "loop", "mod", "iface", "impl", "import", "let", "log", "loop", "mod",
"mut", "native", "new", "pure", "resource", "mut", "native", "new", "pure", "resource", "true",
"ret", "trait", "type", "unchecked", "unsafe", "while"]; "ret", "trait", "type", "unchecked", "unsafe", "while"];
for keys.each {|word| for keys.each {|word|
words.insert(word, ()); words.insert(word, ());

View file

@ -0,0 +1,2 @@
fn false() { } //! ERROR found `false` in expression position
fn main() { }

View file

@ -0,0 +1,2 @@
fn true() { } //! ERROR found `true` in expression position
fn main() { }