Convert alt to match. Stop parsing alt
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
import ast_util::operator_prec;
|
||||
|
||||
fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool {
|
||||
alt e.node {
|
||||
match e.node {
|
||||
ast::expr_if(_, _, _) | ast::expr_alt(_, _, _) | ast::expr_block(_)
|
||||
| ast::expr_while(_, _) | ast::expr_loop(_)
|
||||
| ast::expr_call(_, _, true) => false,
|
||||
@@ -14,9 +14,9 @@ fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool {
|
||||
}
|
||||
|
||||
fn stmt_ends_with_semi(stmt: ast::stmt) -> bool {
|
||||
alt stmt.node {
|
||||
match stmt.node {
|
||||
ast::stmt_decl(d, _) => {
|
||||
return alt d.node {
|
||||
return match d.node {
|
||||
ast::decl_local(_) => true,
|
||||
ast::decl_item(_) => false
|
||||
}
|
||||
@@ -31,7 +31,7 @@ fn stmt_ends_with_semi(stmt: ast::stmt) -> bool {
|
||||
}
|
||||
|
||||
fn need_parens(expr: @ast::expr, outer_prec: uint) -> bool {
|
||||
alt expr.node {
|
||||
match expr.node {
|
||||
ast::expr_binary(op, _, _) => operator_prec(op) < outer_prec,
|
||||
ast::expr_cast(_, _) => parse::prec::as_prec < outer_prec,
|
||||
// This may be too conservative in some cases
|
||||
@@ -47,8 +47,8 @@ fn need_parens(expr: @ast::expr, outer_prec: uint) -> bool {
|
||||
}
|
||||
|
||||
fn ends_in_lit_int(ex: @ast::expr) -> bool {
|
||||
alt ex.node {
|
||||
ast::expr_lit(node) => alt node {
|
||||
match ex.node {
|
||||
ast::expr_lit(node) => match node {
|
||||
@{node: ast::lit_int(_, ast::ty_i), _}
|
||||
| @{node: ast::lit_int_unsuffixed(_), _} => true,
|
||||
_ => false
|
||||
@@ -60,7 +60,7 @@ fn ends_in_lit_int(ex: @ast::expr) -> bool {
|
||||
ast::expr_log(_, _, sub) | ast::expr_assert(sub) => {
|
||||
ends_in_lit_int(sub)
|
||||
}
|
||||
ast::expr_fail(osub) | ast::expr_ret(osub) => alt osub {
|
||||
ast::expr_fail(osub) | ast::expr_ret(osub) => match osub {
|
||||
some(ex) => ends_in_lit_int(ex),
|
||||
_ => false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user