about summary refs log tree commit diff
path: root/src/comp/syntax/parse
diff options
context:
space:
mode:
Diffstat (limited to 'src/comp/syntax/parse')
-rw-r--r--src/comp/syntax/parse/parser.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index 6a59b395ab4..2b45115f5b9 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -1389,7 +1389,11 @@ fn parse_alt_expr(p: parser) -> @ast::expr {
     while p.peek() != token::RBRACE {
         let pats = parse_pats(p);
         let guard = none;
-        if eat_word(p, "when") { guard = some(parse_expr(p)); }
+        if eat_word(p, "when") {
+            guard = some(parse_expr(p));
+        } else if eat_word(p, "if") {
+            guard = some(parse_expr(p));
+        }
         let blk = parse_block(p);
         arms += [{pats: pats, guard: guard, body: blk}];
     }