diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-08-06 17:14:32 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-08-07 12:23:43 -0700 |
| commit | 2772b2e5c7f85e230bcae13c49eb1386afc6cd0e (patch) | |
| tree | 6161076f339dc2adeffcfbc8bcb6e86882b7b16d /src/libsyntax/parse/classify.rs | |
| parent | abf4421e7c2fce4e768eb20c126989501081f4f9 (diff) | |
| download | rust-2772b2e5c7f85e230bcae13c49eb1386afc6cd0e.tar.gz rust-2772b2e5c7f85e230bcae13c49eb1386afc6cd0e.zip | |
syntax: Make match arm parsing more restrictive again
Require comma separators for all expression types except the plain block
Diffstat (limited to 'src/libsyntax/parse/classify.rs')
| -rw-r--r-- | src/libsyntax/parse/classify.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libsyntax/parse/classify.rs b/src/libsyntax/parse/classify.rs index 38599907e6f..a77c613cb60 100644 --- a/src/libsyntax/parse/classify.rs +++ b/src/libsyntax/parse/classify.rs @@ -13,6 +13,13 @@ fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool { } } +fn expr_is_simple_block(e: @ast::expr) -> bool { + match e.node { + ast::expr_block({node: {rules: ast::default_blk, _}, _}) => true, + _ => false + } +} + fn stmt_ends_with_semi(stmt: ast::stmt) -> bool { match stmt.node { ast::stmt_decl(d, _) => { @@ -52,7 +59,7 @@ fn ends_in_lit_int(ex: @ast::expr) -> bool { @{node: ast::lit_int(_, ast::ty_i), _} | @{node: ast::lit_int_unsuffixed(_), _} => true, _ => false - } + }, ast::expr_binary(_, _, sub) | ast::expr_unary(_, sub) | ast::expr_move(_, sub) | ast::expr_copy(sub) | ast::expr_assign(_, sub) | @@ -63,7 +70,7 @@ fn ends_in_lit_int(ex: @ast::expr) -> bool { ast::expr_fail(osub) | ast::expr_ret(osub) => match osub { some(ex) => ends_in_lit_int(ex), _ => false - } + }, _ => false } } |
