Register new snapshots, purge log_err and log_full in favour of log(...).

This commit is contained in:
Graydon Hoare 2011-12-22 17:53:53 -08:00
parent ccb5b6fb25
commit f0dfbe7b1b
243 changed files with 705 additions and 702 deletions

View file

@ -596,7 +596,7 @@ fn link_binary(sess: session::session,
fs::connect(fs::dirname(out_filename), long_libname)
} else { out_filename };
log_full(core::debug, "output: " + output);
log(debug, "output: " + output);
// The default library location, we need this to find the runtime.
// The location of crates will be determined as needed.

View file

@ -211,7 +211,7 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t {
'a' { kind_noncopyable }
c {
#error("unexpected char in encoded type param: ");
log_full(core::error, c);
log(error, c);
fail
}
};

View file

@ -715,8 +715,8 @@ fn create_function(fcx: @fn_ctxt) -> @metadata<subprogram_md> {
let dbg_cx = option::get(cx.dbg_cx);
#debug("~~");
log_full(core::debug, fcx.id);
log_full(core::debug, cx.sess.span_str(fcx.sp));
log(debug, fcx.id);
log(debug, cx.sess.span_str(fcx.sp));
let (ident, ret_ty, id) = alt cx.ast_map.get(fcx.id) {
ast_map::node_item(item) {
@ -746,8 +746,8 @@ fn create_function(fcx: @fn_ctxt) -> @metadata<subprogram_md> {
}
};
log_full(core::debug, ident);
log_full(core::debug, id);
log(debug, ident);
log(debug, id);
let path = str::connect(fcx.lcx.path + [ident], "::");

View file

@ -20,7 +20,7 @@ fn fn_usage_expr(expr: @ast::expr,
alt ctx.tcx.def_map.find(expr.id) {
some(ast::def_fn(_, ast::unsafe_fn.)) |
some(ast::def_native_fn(_, ast::unsafe_fn.)) {
log_full(core::error, ("expr=", expr_to_str(expr)));
log(error, ("expr=", expr_to_str(expr)));
ctx.tcx.sess.span_fatal(
expr.span,
"unsafe functions can only be called");

View file

@ -447,9 +447,9 @@ fn visit_fn_block_with_scope(_e: @env, decl: fn_decl, blk: ast::blk,
span: span, id: node_id,
sc: scopes, v: vt<scopes>) {
let scope = scope_fn_expr(decl, id, []);
log_full(core::debug, ("scope=", scope));
log(debug, ("scope=", scope));
visit::visit_fn_block(decl, blk, span, id, cons(scope, @sc), v);
log_full(core::debug, ("unscope"));
log(debug, ("unscope"));
}
fn visit_block_with_scope(b: ast::blk, sc: scopes, v: vt<scopes>) {

View file

@ -1120,7 +1120,7 @@ fn set_glue_inlining(cx: @local_ctxt, f: ValueRef, t: ty::t) {
fn declare_tydesc(cx: @local_ctxt, sp: span, t: ty::t, ty_params: [uint],
is_obj_body: bool) ->
@tydesc_info {
log_full(core::debug, "+++ declare_tydesc " + ty_to_str(cx.ccx.tcx, t));
log(debug, "+++ declare_tydesc " + ty_to_str(cx.ccx.tcx, t));
let ccx = cx.ccx;
let llsize;
let llalign;
@ -1156,7 +1156,7 @@ fn declare_tydesc(cx: @local_ctxt, sp: span, t: ty::t, ty_params: [uint],
mutable cmp_glue: none::<ValueRef>,
ty_params: ty_params,
is_obj_body: is_obj_body};
log_full(core::debug, "--- declare_tydesc " + ty_to_str(cx.ccx.tcx, t));
log(debug, "--- declare_tydesc " + ty_to_str(cx.ccx.tcx, t));
ret info;
}

View file

@ -516,7 +516,7 @@ fn add_span_comment(bcx: @block_ctxt, sp: span, text: str) {
let ccx = bcx_ccx(bcx);
if (!ccx.sess.get_opts().no_asm_comments) {
let s = text + " (" + ccx.sess.span_str(sp) + ")";
log_full(core::debug, s);
log(debug, s);
add_comment(bcx, s);
}
}

View file

@ -15,12 +15,12 @@ fn collect_ids_block(b: blk, rs: @mutable [node_id]) { *rs += [b.node.id]; }
fn collect_ids_stmt(s: @stmt, rs: @mutable [node_id]) {
alt s.node {
stmt_decl(_, id) {
log_full(core::debug, "node_id " + int::str(id));
log(debug, "node_id " + int::str(id));
log_stmt(*s);;
*rs += [id];
}
stmt_expr(_, id) {
log_full(core::debug, "node_id " + int::str(id));
log(debug, "node_id " + int::str(id));
log_stmt(*s);;
*rs += [id];
}
@ -44,7 +44,7 @@ fn node_ids_in_fn(body: blk, rs: @mutable [node_id]) {
fn init_vecs(ccx: crate_ctxt, node_ids: [node_id], len: uint) {
for i: node_id in node_ids {
log_full(core::debug, int::str(i) + " |-> " + uint::str(len));
log(debug, int::str(i) + " |-> " + uint::str(len));
add_node(ccx, i, empty_ann(len));
}
}

View file

@ -78,7 +78,7 @@ fn tritv_to_str(fcx: fn_ctxt, v: tritv::t) -> str {
}
fn log_tritv(fcx: fn_ctxt, v: tritv::t) {
log_full(core::debug, tritv_to_str(fcx, v));
log(debug, tritv_to_str(fcx, v));
}
fn first_difference_string(fcx: fn_ctxt, expected: tritv::t, actual: tritv::t)
@ -94,7 +94,7 @@ fn first_difference_string(fcx: fn_ctxt, expected: tritv::t, actual: tritv::t)
}
fn log_tritv_err(fcx: fn_ctxt, v: tritv::t) {
log_full(core::error, tritv_to_str(fcx, v));
log(error, tritv_to_str(fcx, v));
}
fn tos(v: [uint]) -> str {
@ -107,9 +107,9 @@ fn tos(v: [uint]) -> str {
ret rslt;
}
fn log_cond(v: [uint]) { log_full(core::debug, tos(v)); }
fn log_cond(v: [uint]) { log(debug, tos(v)); }
fn log_cond_err(v: [uint]) { log_full(core::error, tos(v)); }
fn log_cond_err(v: [uint]) { log(error, tos(v)); }
fn log_pp(pp: pre_and_post) {
let p1 = tritv::to_vec(pp.precondition);
@ -147,11 +147,11 @@ fn log_states_err(pp: pre_and_post_state) {
log_cond_err(p2);
}
fn print_ident(i: ident) { log_full(core::debug, " " + i + " "); }
fn print_ident(i: ident) { log(debug, " " + i + " "); }
fn print_idents(&idents: [ident]) {
if vec::len::<ident>(idents) == 0u { ret; }
log_full(core::debug, "an ident: " + vec::pop::<ident>(idents));
log(debug, "an ident: " + vec::pop::<ident>(idents));
print_idents(idents);
}
@ -550,7 +550,7 @@ fn match_args(fcx: fn_ctxt, occs: @mutable [pred_args],
#debug("match_args: looking at %s",
constr_args_to_str(fn (i: inst) -> str { ret i.ident; }, occ));
for pd: pred_args in *occs {
log_full(core::debug,
log(debug,
"match_args: candidate " + pred_args_to_str(pd));
fn eq(p: inst, q: inst) -> bool { ret p.node == q.node; }
if ty::args_eq(eq, pd.node.args, occ) { ret pd.node.bit_num; }
@ -765,7 +765,7 @@ fn replace(subst: subst, d: pred_args) -> [constr_arg_general_<inst>] {
for (constr_arg_general_<tup(ident, def_id)> p in rslt) {
alt (p) {
case (carg_ident(?p)) {
log_full(core::error, p._0);
log(error, p._0);
}
case (_) {}
}
@ -980,7 +980,7 @@ fn args_mention<T>(args: [@constr_arg_use], q: fn([T], node_id) -> bool,
alt (a.node) {
case (carg_ident(?p1)) {
auto res = q(s, p1._1);
log_full(core::error, (res));
log(error, (res));
res
}
case (_) { false }

View file

@ -72,7 +72,7 @@ fn check_states_stmt(s: @stmt, fcx: fn_ctxt, v: visit::vt<fn_ctxt>) {
#debug("check_states_stmt:");
log_full(core::debug, print::pprust::stmt_to_str(*s));
log(debug, print::pprust::stmt_to_str(*s));
#debug("prec = ");
log_tritv(fcx, prec);
#debug("pres = ");

View file

@ -13,7 +13,7 @@ type ctxt = {cs: @mutable [sp_constr], tcx: ty::ctxt};
fn collect_local(loc: @local, cx: ctxt, v: visit::vt<ctxt>) {
pat_bindings(loc.node.pat) {|p|
let ident = alt p.node { pat_bind(id, _) { id } };
log_full(core::debug, "collect_local: pushing " + ident);;
log(debug, "collect_local: pushing " + ident);;
*cx.cs += [respan(loc.span, ninit(p.id, ident))];
};
visit::visit_local(loc, cx, v);
@ -65,7 +65,7 @@ fn find_locals(tcx: ty::ctxt,
fn add_constraint(tcx: ty::ctxt, c: sp_constr, next: uint, tbl: constr_map) ->
uint {
log_full(core::debug,
log(debug,
constraint_to_str(tcx, c) + " |-> " + uint::str(next));
alt c.node {
ninit(id, i) { tbl.insert(local_def(id), cinit(next, c.span, i)); }

View file

@ -276,7 +276,7 @@ fn handle_var(fcx: fn_ctxt, rslt: pre_and_post, id: node_id, name: ident) {
}
fn handle_var_def(fcx: fn_ctxt, rslt: pre_and_post, def: def, name: ident) {
log_full(core::debug, ("handle_var_def: ", def, name));
log(debug, ("handle_var_def: ", def, name));
alt def {
def_local(d_id, _) | def_arg(d_id, _) {
use_var(fcx, d_id.node);
@ -302,7 +302,7 @@ fn find_pre_post_expr_fn_upvars(fcx: fn_ctxt, e: @expr) {
let rslt = expr_pp(fcx.ccx, e);
clear_pp(rslt);
for def in *freevars::get_freevars(fcx.ccx.tcx, e.id) {
log_full(core::debug, ("handle_var_def: def=", def));
log(debug, ("handle_var_def: def=", def));
handle_var_def(fcx, rslt, def.def, "upvar");
}
}
@ -358,7 +358,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) {
vec::iter(cap_clause.moves, use_cap_item);
vec::iter(cap_clause.moves) { |cap_item|
log_full(core::debug, ("forget_in_postcond: ", cap_item));
log(debug, ("forget_in_postcond: ", cap_item));
forget_in_postcond(fcx, e.id, cap_item.id);
}
}

View file

@ -621,7 +621,7 @@ fn find_pre_post_state_stmt(fcx: fn_ctxt, pres: prestate, s: @stmt) -> bool {
let stmt_ann = stmt_to_ann(fcx.ccx, *s);
/*
log_full(core::error, ("[" + fcx.name + "]"));
log(error, ("[" + fcx.name + "]"));
#error("*At beginning: stmt = ");
log_stmt_err(*s);
#error("*prestate = ");
@ -653,7 +653,7 @@ fn find_pre_post_state_stmt(fcx: fn_ctxt, pres: prestate, s: @stmt) -> bool {
#error("poststate =");
log_tritv_err(fcx, stmt_ann.states.poststate);
#error("changed =");
log_full(core::error, changed);
log(error, changed);
*/
ret changed;
@ -727,7 +727,7 @@ fn find_pre_post_state_block(fcx: fn_ctxt, pres0: prestate, b: blk) -> bool {
#error("post:");
log_tritv_err(fcx, post);
#error("changed = ");
log_full(core::error, changed);
log(error, changed);
*/
ret changed;
@ -774,7 +774,7 @@ fn find_pre_post_state_fn(fcx: fn_ctxt,
/*
#error("find_pre_post_state_fn");
log_full(core::error, changed);
log(error, changed);
fcx.ccx.tcx.sess.span_note(f_body.span, fcx.name);
*/

View file

@ -29,7 +29,7 @@ fn expand_syntax_ext(cx: ext_ctxt, sp: span, arg: @ast::expr,
"first argument to #fmt must be a " + "string literal.");
let fmtspan = args[0].span;
#debug("Format string:");
log_full(core::debug, fmt);
log(debug, fmt);
fn parse_fmt_err_(cx: ext_ctxt, sp: span, msg: str) -> ! {
cx.span_fatal(sp, msg);
}
@ -252,7 +252,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: [piece], args: [@ast::expr])
}
fn log_conv(c: conv) {
alt c.param {
some(p) { log_full(core::debug, "param: " + int::to_str(p, 10u)); }
some(p) { log(debug, "param: " + int::to_str(p, 10u)); }
_ { #debug("param: none"); }
}
for f: flag in c.flags {
@ -265,20 +265,20 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: [piece], args: [@ast::expr])
}
}
alt c.width {
count_is(i) { log_full(core::debug,
count_is(i) { log(debug,
"width: count is " + int::to_str(i, 10u)); }
count_is_param(i) {
log_full(core::debug,
log(debug,
"width: count is param " + int::to_str(i, 10u));
}
count_is_next_param. { #debug("width: count is next param"); }
count_implied. { #debug("width: count is implied"); }
}
alt c.precision {
count_is(i) { log_full(core::debug,
count_is(i) { log(debug,
"prec: count is " + int::to_str(i, 10u)); }
count_is_param(i) {
log_full(core::debug,
log(debug,
"prec: count is param " + int::to_str(i, 10u));
}
count_is_next_param. { #debug("prec: count is next param"); }

View file

@ -580,7 +580,7 @@ fn read_line_comments(rdr: reader, code_to_the_left: bool) -> cmnt {
let lines: [str] = [];
while rdr.curr() == '/' && rdr.next() == '/' {
let line = read_one_line_comment(rdr);
log_full(core::debug, line);
log(debug, line);
lines += [line];
consume_non_eol_whitespace(rdr);
}
@ -603,7 +603,7 @@ fn trim_whitespace_prefix_and_push_line(&lines: [str], s: str, col: uint) {
s1 = str::slice(s, col, str::byte_len(s));
} else { s1 = ""; }
} else { s1 = s; }
log_full(core::debug, "pushing line: " + s1);
log(debug, "pushing line: " + s1);
lines += [s1];
}
@ -707,7 +707,7 @@ fn gather_comments_and_literals(cm: codemap::codemap, path: str,
if is_lit(tok.tok) {
literals += [{lit: rdr.get_str_from(tok.bpos), pos: tok.chpos}];
}
log_full(core::debug, "tok: " + token::to_str(rdr, tok.tok));
log(debug, "tok: " + token::to_str(rdr, tok.tok));
first_read = false;
}
ret {cmnts: comments, lits: literals};

View file

@ -165,8 +165,7 @@ fn bad_expr_word_table() -> hashmap<str, ()> {
"cont", "ret", "be", "fail", "type", "resource", "check",
"assert", "claim", "native", "fn", "lambda", "pure",
"unsafe", "block", "import", "export", "let", "const",
"log", "log_err", "log_full",
"tag", "obj", "copy", "sendfn", "impl"] {
"log", "tag", "obj", "copy", "sendfn", "impl"] {
words.insert(word, ());
}
words
@ -910,10 +909,7 @@ fn parse_bottom_expr(p: parser) -> @ast::expr {
hi = e.span.hi;
ex = ast::expr_fail(some(e));
} else { ex = ast::expr_fail(none); }
} else if
(eat_word(p, "log_full")
|| eat_word(p, "log")
|| eat_word(p, "log_err")) {
} else if eat_word(p, "log") {
expect(p, token::LPAREN);
let lvl = parse_expr(p);
expect(p, token::COMMA);

View file

@ -413,7 +413,7 @@ obj printer(out: io::writer,
fn print(x: token, L: int) {
#debug("print %s %d (remaining line space=%d)", tok_str(x), L,
space);
log_full(core::debug, buf_str(token, size, left, right, 6u));
log(debug, buf_str(token, size, left, right, 6u));
alt x {
BEGIN(b) {
if L > space {

View file

@ -916,7 +916,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
1 { word_nbsp(s, "log"); print_expr(s, expr); }
0 { word_nbsp(s, "log_err"); print_expr(s, expr); }
2 {
word_nbsp(s, "log_full");
word_nbsp(s, "log");
popen(s);
print_expr(s, lexp);
word(s.s, ",");

View file

@ -36,38 +36,38 @@ fn field_exprs(fields: [ast::field]) -> [@ast::expr] {
}
fn log_expr(e: ast::expr) {
log_full(core::debug, print::pprust::expr_to_str(@e));
log(debug, print::pprust::expr_to_str(@e));
}
fn log_expr_err(e: ast::expr) {
log_full(core::error, print::pprust::expr_to_str(@e));
log(error, print::pprust::expr_to_str(@e));
}
fn log_ty_err(t: @ty) {
log_full(core::error, print::pprust::ty_to_str(t));
log(error, print::pprust::ty_to_str(t));
}
fn log_pat_err(p: @pat) {
log_full(core::error, print::pprust::pat_to_str(p));
log(error, print::pprust::pat_to_str(p));
}
fn log_block(b: ast::blk) {
log_full(core::debug, print::pprust::block_to_str(b));
log(debug, print::pprust::block_to_str(b));
}
fn log_block_err(b: ast::blk) {
log_full(core::error, print::pprust::block_to_str(b));
log(error, print::pprust::block_to_str(b));
}
fn log_item_err(i: @ast::item) {
log_full(core::error, print::pprust::item_to_str(i));
log(error, print::pprust::item_to_str(i));
}
fn log_stmt(st: ast::stmt) {
log_full(core::debug, print::pprust::stmt_to_str(st));
log(debug, print::pprust::stmt_to_str(st));
}
fn log_stmt_err(st: ast::stmt) {
log_full(core::error, print::pprust::stmt_to_str(st));
log(error, print::pprust::stmt_to_str(st));
}
fn has_nonlocal_exits(b: ast::blk) -> bool {