diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2011-12-29 07:13:27 -0800 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-01-03 13:13:51 -0800 |
| commit | de383bcfedc5ac67c6a27c51f1a8226f5a9bdcd0 (patch) | |
| tree | 9525fd69374833f9034c11ca668a8095fc61db29 /src/comp/syntax/parse | |
| parent | 9e1dc703d2fce55ca8c79fdc68188560c6d78d9c (diff) | |
| download | rust-de383bcfedc5ac67c6a27c51f1a8226f5a9bdcd0.tar.gz rust-de383bcfedc5ac67c6a27c51f1a8226f5a9bdcd0.zip | |
extend parser so that expressions that do not require semi-colons
to be statements are not considered expressions in the tail position
Diffstat (limited to 'src/comp/syntax/parse')
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 426799454c6..0ce5f8628dc 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -1621,8 +1621,8 @@ fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool { fn stmt_to_expr(stmt: @ast::stmt) -> option::t<@ast::expr> { alt stmt.node { - ast::stmt_expr(e, _) { some(e) } - ast::stmt_decl(_, _) { none } + ast::stmt_expr(e, _) when expr_requires_semi_to_be_stmt(e) { some(e) } + _ { none } } } |
