diff options
Diffstat (limited to 'src/comp/syntax/parse/parser.rs')
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index d20f345b3af..b20c7905013 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -1360,8 +1360,12 @@ fn parse_alt_expr(p: &parser) -> @ast::expr { let arms: [ast::arm] = []; while p.peek() != token::RBRACE { let pats = parse_pats(p); + let guard = none; + if eat_word(p, "when") { + guard = some(parse_expr(p)); + } let blk = parse_block(p); - arms += [{pats: pats, body: blk}]; + arms += [{pats: pats, guard: guard, body: blk}]; } let hi = p.get_hi_pos(); p.bump(); |
