mirror of
https://github.com/rust-lang/rust
synced 2024-09-05 08:37:14 +00:00
syntax: fix pretty printing __log stmts
This commit is contained in:
parent
2e0b363a7f
commit
7a199d41a9
|
@ -1335,7 +1335,7 @@ fn propagate_through_expr(&self, expr: @expr, succ: LiveNode)
|
|||
self.propagate_through_expr(l, ln)
|
||||
}
|
||||
|
||||
expr_log(_, l, r) |
|
||||
expr_log(l, r) |
|
||||
expr_index(l, r) |
|
||||
expr_binary(_, l, r) => {
|
||||
self.propagate_through_exprs(~[l, r], succ)
|
||||
|
|
|
@ -567,7 +567,7 @@ fn use_expr(&self,
|
|||
self.consume_block(blk, visitor);
|
||||
}
|
||||
|
||||
expr_log(_, a_expr, b_expr) => {
|
||||
expr_log(a_expr, b_expr) => {
|
||||
self.consume_expr(a_expr, visitor);
|
||||
self.use_expr(b_expr, Read, visitor);
|
||||
}
|
||||
|
|
|
@ -507,7 +507,7 @@ fn trans_rvalue_stmt_unadjusted(bcx: block, expr: @ast::expr) -> block {
|
|||
ast::expr_ret(ex) => {
|
||||
return controlflow::trans_ret(bcx, ex);
|
||||
}
|
||||
ast::expr_log(_, lvl, a) => {
|
||||
ast::expr_log(lvl, a) => {
|
||||
return controlflow::trans_log(expr, lvl, bcx, a);
|
||||
}
|
||||
ast::expr_while(cond, ref body) => {
|
||||
|
|
|
@ -329,7 +329,7 @@ pub fn mark_for_expr(cx: Context, e: @expr) {
|
|||
type_needs(cx, use_repr, ty::type_autoderef(cx.ccx.tcx, base_ty));
|
||||
mark_for_method_call(cx, e.id, e.callee_id);
|
||||
}
|
||||
expr_log(_, _, val) => {
|
||||
expr_log(_, val) => {
|
||||
node_type_needs(cx, use_tydesc, val.id);
|
||||
}
|
||||
expr_call(f, _, _) => {
|
||||
|
|
|
@ -2402,7 +2402,7 @@ fn check_loop_body(fcx: @mut FnCtxt,
|
|||
}
|
||||
fcx.write_bot(id);
|
||||
}
|
||||
ast::expr_log(_, lv, e) => {
|
||||
ast::expr_log(lv, e) => {
|
||||
check_expr_has_type(fcx, lv,
|
||||
ty::mk_mach_uint(tcx, ast::ty_u32));
|
||||
|
||||
|
|
|
@ -543,12 +543,6 @@ pub struct expr {
|
|||
span: span,
|
||||
}
|
||||
|
||||
#[auto_encode]
|
||||
#[auto_decode]
|
||||
#[deriving(Eq)]
|
||||
pub enum log_level { error, debug, log_other }
|
||||
// 0 = error, 1 = debug, 2 = log_other
|
||||
|
||||
#[auto_encode]
|
||||
#[auto_decode]
|
||||
#[deriving(Eq)]
|
||||
|
@ -598,7 +592,7 @@ pub enum expr_ {
|
|||
expr_break(Option<ident>),
|
||||
expr_again(Option<ident>),
|
||||
expr_ret(Option<@expr>),
|
||||
expr_log(log_level, @expr, @expr),
|
||||
expr_log(@expr, @expr),
|
||||
|
||||
expr_inline_asm(@~str, // asm
|
||||
~[(@~str, @expr)], // inputs
|
||||
|
|
|
@ -552,9 +552,8 @@ fn fold_field_(field: field, fld: @ast_fold) -> field {
|
|||
expr_ret(ref e) => {
|
||||
expr_ret(e.map(|x| fld.fold_expr(*x)))
|
||||
}
|
||||
expr_log(i, lv, e) => {
|
||||
expr_log(lv, e) => {
|
||||
expr_log(
|
||||
i,
|
||||
fld.fold_expr(lv),
|
||||
fld.fold_expr(e)
|
||||
)
|
||||
|
|
|
@ -1230,7 +1230,7 @@ fn parse_bottom_expr(&self) -> @expr {
|
|||
let lvl = self.parse_expr();
|
||||
self.expect(&token::COMMA);
|
||||
let e = self.parse_expr();
|
||||
ex = expr_log(ast::log_other, lvl, e);
|
||||
ex = expr_log(lvl, e);
|
||||
hi = self.span.hi;
|
||||
self.expect(&token::RPAREN);
|
||||
} else if self.eat_keyword(&~"return") {
|
||||
|
|
|
@ -1386,20 +1386,14 @@ fn print_field(s: @ps, field: ast::field) {
|
|||
_ => ()
|
||||
}
|
||||
}
|
||||
ast::expr_log(lvl, lexp, expr) => {
|
||||
match lvl {
|
||||
ast::debug => { word_nbsp(s, ~"log"); print_expr(s, expr); }
|
||||
ast::error => { word_nbsp(s, ~"log_err"); print_expr(s, expr); }
|
||||
ast::log_other => {
|
||||
word_nbsp(s, ~"log");
|
||||
popen(s);
|
||||
print_expr(s, lexp);
|
||||
word(s.s, ~",");
|
||||
space_if_not_bol(s);
|
||||
print_expr(s, expr);
|
||||
pclose(s);
|
||||
}
|
||||
}
|
||||
ast::expr_log(lexp, expr) => {
|
||||
word(s.s, ~"__log");
|
||||
popen(s);
|
||||
print_expr(s, lexp);
|
||||
word(s.s, ~",");
|
||||
space_if_not_bol(s);
|
||||
print_expr(s, expr);
|
||||
pclose(s);
|
||||
}
|
||||
ast::expr_inline_asm(a, in, out, c, v, _) => {
|
||||
if v {
|
||||
|
|
|
@ -559,7 +559,7 @@ pub fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) {
|
|||
expr_break(_) => (),
|
||||
expr_again(_) => (),
|
||||
expr_ret(eo) => visit_expr_opt(eo, e, v),
|
||||
expr_log(_, lv, x) => {
|
||||
expr_log(lv, x) => {
|
||||
(v.visit_expr)(lv, e, v);
|
||||
(v.visit_expr)(x, e, v);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue