Register snapshots and switch logging over to use of log_full or #error / #debug.

This commit is contained in:
Graydon Hoare 2011-12-22 14:42:52 -08:00
parent 3b61064631
commit 8b580954fe
326 changed files with 1347 additions and 1144 deletions

View file

@ -588,15 +588,15 @@ fn link_binary(sess: session::session,
let long_libname =
std::os::dylib_filename(#fmt("%s-%s-%s",
lm.name, lm.extras_hash, lm.vers));
log "link_meta.name: " + lm.name;
log "long_libname: " + long_libname;
log "out_filename: " + out_filename;
log "dirname(out_filename): " + fs::dirname(out_filename);
#debug("link_meta.name: %s", lm.name);
#debug("long_libname: %s", long_libname);
#debug("out_filename: %s", out_filename);
#debug("dirname(out_filename): %s", fs::dirname(out_filename));
fs::connect(fs::dirname(out_filename), long_libname)
} else { out_filename };
log "output: " + output;
log_full(core::debug, "output: " + output);
// The default library location, we need this to find the runtime.
// The location of crates will be determined as needed.
@ -670,7 +670,7 @@ fn link_binary(sess: session::session,
gcc_args += rpath::get_rpath_flags(sess, output);
log #fmt("gcc link args: %s", str::connect(gcc_args, " "));
#debug("gcc link args: %s", str::connect(gcc_args, " "));
// We run 'gcc' here
let prog = run::program_output(prog, gcc_args);
if 0 != prog.status {

View file

@ -21,7 +21,7 @@ fn get_rpath_flags(sess: session::session, out_filename: str) -> [str] {
ret [];
}
log "preparing the RPATH!";
#debug("preparing the RPATH!");
let cwd = os::getcwd();
let sysroot = sess.filesearch().sysroot();
@ -52,14 +52,14 @@ fn rpaths_to_flags(rpaths: [str]) -> [str] {
fn get_rpaths(os: session::os, cwd: fs::path, sysroot: fs::path,
output: fs::path, libs: [fs::path],
target_triple: str) -> [str] {
log #fmt("cwd: %s", cwd);
log #fmt("sysroot: %s", sysroot);
log #fmt("output: %s", output);
log #fmt("libs:");
#debug("cwd: %s", cwd);
#debug("sysroot: %s", sysroot);
#debug("output: %s", output);
#debug("libs:");
for libpath in libs {
log #fmt(" %s", libpath);
#debug(" %s", libpath);
}
log #fmt("target_triple: %s", target_triple);
#debug("target_triple: %s", target_triple);
// Use relative paths to the libraries. Binaries can be moved
// as long as they maintain the relative relationship to the
@ -74,9 +74,9 @@ fn get_rpaths(os: session::os, cwd: fs::path, sysroot: fs::path,
let fallback_rpaths = [get_install_prefix_rpath(cwd, target_triple)];
fn log_rpaths(desc: str, rpaths: [str]) {
log #fmt("%s rpaths:", desc);
#debug("%s rpaths:", desc);
for rpath in rpaths {
log #fmt(" %s", rpath);
#debug(" %s", rpath);
}
}

View file

@ -34,7 +34,7 @@ fn find_linkage_metas(attrs: [ast::attribute]) -> [@ast::meta_item] {
for attr: ast::attribute in find_attrs_by_name(attrs, "link") {
alt attr.node.value.node {
ast::meta_list(_, items) { metas += items; }
_ { log "ignoring link attribute that has incorrect type"; }
_ { #debug("ignoring link attribute that has incorrect type"); }
}
}
ret metas;
@ -140,9 +140,9 @@ fn contains(haystack: [@ast::meta_item], needle: @ast::meta_item) -> bool {
for item: @ast::meta_item in haystack {
log #fmt["looking in %s",
syntax::print::pprust::meta_item_to_str(*item)];
if eq(item, needle) { log "found it!"; ret true; }
if eq(item, needle) { #debug("found it!"); ret true; }
}
log "found it not :(";
#debug("found it not :(");
ret false;
}

View file

@ -79,7 +79,7 @@ fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) ->
@ast::item {
cx.path += [i.ident];
log #fmt["current path: %s", ast_util::path_name_i(cx.path)];
#debug("current path: %s", ast_util::path_name_i(cx.path));
if is_test_fn(i) {
alt i.node {
@ -89,12 +89,12 @@ fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) ->
"unsafe functions cannot be used for tests");
}
_ {
log "this is a test function";
#debug("this is a test function");
let test = {span: i.span,
path: cx.path, ignore: is_ignored(cx, i),
should_fail: should_fail(i)};
cx.testfns += [test];
log #fmt["have %u test functions", vec::len(cx.testfns)];
#debug("have %u test functions", vec::len(cx.testfns));
}
}
}
@ -177,7 +177,7 @@ fn mk_test_module(cx: test_ctxt) -> @ast::item {
node: item_,
span: dummy_sp()};
log #fmt["Synthetic test module:\n%s\n", pprust::item_to_str(@item)];
#debug("Synthetic test module:\n%s\n", pprust::item_to_str(@item));
ret @item;
}
@ -242,7 +242,7 @@ fn mk_test_desc_vec_ty(cx: test_ctxt) -> @ast::ty {
}
fn mk_test_desc_vec(cx: test_ctxt) -> @ast::expr {
log #fmt["building test vector from %u tests", vec::len(cx.testfns)];
#debug("building test vector from %u tests", vec::len(cx.testfns));
let descs = [];
for test: test in cx.testfns {
let test_ = test; // Satisfy alias analysis
@ -258,7 +258,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr {
let span = test.span;
let path = test.path;
log #fmt["encoding %s", ast_util::path_name_i(path)];
#debug("encoding %s", ast_util::path_name_i(path));
let name_lit: ast::lit =
nospan(ast::lit_str(ast_util::path_name_i(path)));

View file

@ -1010,7 +1010,7 @@ fn type_to_str_inner(names: type_names, outer0: [TypeRef], ty: TypeRef) ->
12 { ret "Opaque"; }
13 { ret "Vector"; }
14 { ret "Metadata"; }
_ { log_err #fmt["unknown TypeKind %d", kind as int]; fail; }
_ { #error("unknown TypeKind %d", kind as int); fail; }
}
}

View file

@ -107,15 +107,15 @@ fn metadata_matches(crate_data: @[u8], metas: [@ast::meta_item]) -> bool {
log #fmt["matching %u metadata requirements against %u items",
vec::len(metas), vec::len(linkage_metas)];
log #fmt("crate metadata:");
#debug("crate metadata:");
for have: @ast::meta_item in linkage_metas {
log #fmt(" %s", pprust::meta_item_to_str(*have));
#debug(" %s", pprust::meta_item_to_str(*have));
}
for needed: @ast::meta_item in metas {
log #fmt["looking for %s", pprust::meta_item_to_str(*needed)];
#debug("looking for %s", pprust::meta_item_to_str(*needed));
if !attr::contains(linkage_metas, needed) {
log #fmt["missing %s", pprust::meta_item_to_str(*needed)];
#debug("missing %s", pprust::meta_item_to_str(*needed));
ret false;
}
}
@ -175,26 +175,26 @@ fn find_library_crate_aux(sess: session::session,
let suffix: str = nn.suffix;
ret filesearch::search(filesearch, { |path|
log #fmt("inspecting file %s", path);
#debug("inspecting file %s", path);
let f: str = fs::basename(path);
if !(str::starts_with(f, prefix) && str::ends_with(f, suffix)) {
log #fmt["skipping %s, doesn't look like %s*%s", path, prefix,
suffix];
option::none
} else {
log #fmt("%s is a candidate", path);
#debug("%s is a candidate", path);
alt get_metadata_section(sess, path) {
option::some(cvec) {
if !metadata_matches(cvec, metas) {
log #fmt["skipping %s, metadata doesn't match", path];
#debug("skipping %s, metadata doesn't match", path);
option::none
} else {
log #fmt["found %s with matching metadata", path];
#debug("found %s with matching metadata", path);
option::some({ident: path, data: cvec})
}
}
_ {
log #fmt("could not load metadata for %s", path);
#debug("could not load metadata for %s", path);
option::none
}
}
@ -270,21 +270,21 @@ fn resolve_crate(e: env, ident: ast::ident, metas: [@ast::meta_item],
// Go through the crate metadata and load any crates that it references
fn resolve_crate_deps(e: env, cdata: @[u8]) -> cstore::cnum_map {
log "resolving deps of external crate";
#debug("resolving deps of external crate");
// The map from crate numbers in the crate we're resolving to local crate
// numbers
let cnum_map = new_int_hash::<ast::crate_num>();
for dep: decoder::crate_dep in decoder::get_crate_deps(cdata) {
let extrn_cnum = dep.cnum;
let cname = dep.ident;
log #fmt["resolving dep %s", cname];
#debug("resolving dep %s", cname);
if e.crate_cache.contains_key(cname) {
log "already have it";
#debug("already have it");
// We've already seen this crate
let local_cnum = e.crate_cache.get(cname);
cnum_map.insert(extrn_cnum, local_cnum);
} else {
log "need to load it";
#debug("need to load it");
// This is a new one so we've got to load it
// FIXME: Need better error reporting than just a bogus span
let fake_span = ast_util::dummy_sp();

View file

@ -127,16 +127,16 @@ fn get_dep_hashes(cstore: cstore) -> [str] {
p(cstore).use_crate_map.values {|cnum|
let cdata = cstore::get_crate_data(cstore, cnum);
let hash = decoder::get_crate_hash(cdata.data);
log #fmt("Add hash[%s]: %s", cdata.name, hash);
#debug("Add hash[%s]: %s", cdata.name, hash);
result += [{name: cdata.name, hash: hash}];
};
fn lteq(a: crate_hash, b: crate_hash) -> bool {
ret a.name <= b.name;
}
let sorted = std::sort::merge_sort(lteq, result);
log "sorted:";
#debug("sorted:");
for x in sorted {
log #fmt(" hash[%s]: %s", x.name, x.hash);
#debug(" hash[%s]: %s", x.name, x.hash);
}
fn mapper(ch: crate_hash) -> str { ret ch.hash; }
ret vec::map(sorted, mapper);

View file

@ -124,7 +124,7 @@ fn parse_constr_arg(st: @pstate, _sd: str_def) -> ast::fn_constr_arg {
// FIXME
ret ast::carg_ident((c as uint) - 48u);
} else {
log_err "Lit args are unimplemented";
#error("Lit args are unimplemented");
fail; // FIXME
}
/*
@ -210,8 +210,8 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t {
'c' { kind_copyable }
'a' { kind_noncopyable }
c {
log_err "unexpected char in encoded type param: ";
log_err c;
#error("unexpected char in encoded type param: ");
log_full(core::error, c);
fail
}
};
@ -318,7 +318,7 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t {
assert (next(st) as char == ']');
ret ty::mk_constr(st.tcx, tt, tcs);
}
c { log_err "unexpected char in type string: "; log_err c; fail; }
c { #error("unexpected char in type string: %c", c); fail;}
}
}
@ -393,7 +393,7 @@ fn parse_def_id(buf: [u8]) -> ast::def_id {
let len = vec::len::<u8>(buf);
while colon_idx < len && buf[colon_idx] != ':' as u8 { colon_idx += 1u; }
if colon_idx == len {
log_err "didn't find ':' when parsing def id";
#error("didn't find ':' when parsing def id");
fail;
}
let crate_part = vec::slice::<u8>(buf, 0u, colon_idx);

View file

@ -714,9 +714,9 @@ fn create_function(fcx: @fn_ctxt) -> @metadata<subprogram_md> {
let cx = fcx_ccx(fcx);
let dbg_cx = option::get(cx.dbg_cx);
log "~~";
log fcx.id;
log cx.sess.span_str(fcx.sp);
#debug("~~");
log_full(core::debug, fcx.id);
log_full(core::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 ident;
log id;
log_full(core::debug, ident);
log_full(core::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_err ("expr=", expr_to_str(expr));
log_full(core::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 ("scope=", scope);
log_full(core::debug, ("scope=", scope));
visit::visit_fn_block(decl, blk, span, id, cons(scope, @sc), v);
log ("unscope");
log_full(core::debug, ("unscope"));
}
fn visit_block_with_scope(b: ast::blk, sc: scopes, v: vt<scopes>) {

View file

@ -1122,7 +1122,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 "+++ declare_tydesc " + ty_to_str(cx.ccx.tcx, t);
log_full(core::debug, "+++ declare_tydesc " + ty_to_str(cx.ccx.tcx, t));
let ccx = cx.ccx;
let llsize;
let llalign;
@ -1158,7 +1158,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 "--- declare_tydesc " + ty_to_str(cx.ccx.tcx, t);
log_full(core::debug, "--- declare_tydesc " + ty_to_str(cx.ccx.tcx, t));
ret info;
}
@ -5713,16 +5713,16 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
// Translate the metadata.
write_metadata(cx.ccx, crate);
if ccx.sess.get_opts().stats {
log_err "--- trans stats ---";
log_err #fmt["n_static_tydescs: %u", ccx.stats.n_static_tydescs];
log_err #fmt["n_derived_tydescs: %u", ccx.stats.n_derived_tydescs];
log_err #fmt["n_glues_created: %u", ccx.stats.n_glues_created];
log_err #fmt["n_null_glues: %u", ccx.stats.n_null_glues];
log_err #fmt["n_real_glues: %u", ccx.stats.n_real_glues];
#error("--- trans stats ---");
#error("n_static_tydescs: %u", ccx.stats.n_static_tydescs);
#error("n_derived_tydescs: %u", ccx.stats.n_derived_tydescs);
#error("n_glues_created: %u", ccx.stats.n_glues_created);
#error("n_null_glues: %u", ccx.stats.n_null_glues);
#error("n_real_glues: %u", ccx.stats.n_real_glues);
for timing: {ident: str, time: int} in *ccx.stats.fn_times {
log_err #fmt["time: %s took %d ms", timing.ident, timing.time];
#error("time: %s took %d ms", timing.ident, timing.time);
}
}
ret (llmod, link_meta);

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 s;
log_full(core::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 "node_id " + int::str(id);
log_full(core::debug, "node_id " + int::str(id));
log_stmt(*s);;
*rs += [id];
}
stmt_expr(_, id) {
log "node_id " + int::str(id);
log_full(core::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 int::str(i) + " |-> " + uint::str(len);
log_full(core::debug, int::str(i) + " |-> " + uint::str(len));
add_node(ccx, i, empty_ann(len));
}
}

View file

@ -77,7 +77,9 @@ fn tritv_to_str(fcx: fn_ctxt, v: tritv::t) -> str {
ret s;
}
fn log_tritv(fcx: fn_ctxt, v: tritv::t) { log tritv_to_str(fcx, v); }
fn log_tritv(fcx: fn_ctxt, v: tritv::t) {
log_full(core::debug, tritv_to_str(fcx, v));
}
fn first_difference_string(fcx: fn_ctxt, expected: tritv::t, actual: tritv::t)
-> str {
@ -91,7 +93,9 @@ fn first_difference_string(fcx: fn_ctxt, expected: tritv::t, actual: tritv::t)
ret s;
}
fn log_tritv_err(fcx: fn_ctxt, v: tritv::t) { log_err tritv_to_str(fcx, v); }
fn log_tritv_err(fcx: fn_ctxt, v: tritv::t) {
log_full(core::error, tritv_to_str(fcx, v));
}
fn tos(v: [uint]) -> str {
let rslt = "";
@ -103,51 +107,51 @@ fn tos(v: [uint]) -> str {
ret rslt;
}
fn log_cond(v: [uint]) { log tos(v); }
fn log_cond(v: [uint]) { log_full(core::debug, tos(v)); }
fn log_cond_err(v: [uint]) { log_err tos(v); }
fn log_cond_err(v: [uint]) { log_full(core::error, tos(v)); }
fn log_pp(pp: pre_and_post) {
let p1 = tritv::to_vec(pp.precondition);
let p2 = tritv::to_vec(pp.postcondition);
log "pre:";
#debug("pre:");
log_cond(p1);
log "post:";
#debug("post:");
log_cond(p2);
}
fn log_pp_err(pp: pre_and_post) {
let p1 = tritv::to_vec(pp.precondition);
let p2 = tritv::to_vec(pp.postcondition);
log_err "pre:";
#error("pre:");
log_cond_err(p1);
log_err "post:";
#error("post:");
log_cond_err(p2);
}
fn log_states(pp: pre_and_post_state) {
let p1 = tritv::to_vec(pp.prestate);
let p2 = tritv::to_vec(pp.poststate);
log "prestate:";
#debug("prestate:");
log_cond(p1);
log "poststate:";
#debug("poststate:");
log_cond(p2);
}
fn log_states_err(pp: pre_and_post_state) {
let p1 = tritv::to_vec(pp.prestate);
let p2 = tritv::to_vec(pp.poststate);
log_err "prestate:";
#error("prestate:");
log_cond_err(p1);
log_err "poststate:";
#error("poststate:");
log_cond_err(p2);
}
fn print_ident(i: ident) { log " " + i + " "; }
fn print_ident(i: ident) { log_full(core::debug, " " + i + " "); }
fn print_idents(&idents: [ident]) {
if vec::len::<ident>(idents) == 0u { ret; }
log "an ident: " + vec::pop::<ident>(idents);
log_full(core::debug, "an ident: " + vec::pop::<ident>(idents));
print_idents(idents);
}
@ -303,7 +307,7 @@ fn get_ts_ann(ccx: crate_ctxt, i: node_id) -> option::t<ts_ann> {
fn node_id_to_ts_ann(ccx: crate_ctxt, id: node_id) -> ts_ann {
alt get_ts_ann(ccx, id) {
none. {
log_err "node_id_to_ts_ann: no ts_ann for node_id " + int::str(id);
#error("node_id_to_ts_ann: no ts_ann for node_id %d", id);
fail;
}
some(t) { ret t; }
@ -311,12 +315,12 @@ fn node_id_to_ts_ann(ccx: crate_ctxt, id: node_id) -> ts_ann {
}
fn node_id_to_poststate(ccx: crate_ctxt, id: node_id) -> poststate {
log "node_id_to_poststate";
#debug("node_id_to_poststate");
ret node_id_to_ts_ann(ccx, id).states.poststate;
}
fn stmt_to_ann(ccx: crate_ctxt, s: stmt) -> ts_ann {
log "stmt_to_ann";
#debug("stmt_to_ann");
alt s.node {
stmt_decl(_, id) { ret node_id_to_ts_ann(ccx, id); }
stmt_expr(_, id) { ret node_id_to_ts_ann(ccx, id); }
@ -326,14 +330,14 @@ fn stmt_to_ann(ccx: crate_ctxt, s: stmt) -> ts_ann {
/* fails if e has no annotation */
fn expr_states(ccx: crate_ctxt, e: @expr) -> pre_and_post_state {
log "expr_states";
#debug("expr_states");
ret node_id_to_ts_ann(ccx, e.id).states;
}
/* fails if e has no annotation */
fn expr_pp(ccx: crate_ctxt, e: @expr) -> pre_and_post {
log "expr_pp";
#debug("expr_pp");
ret node_id_to_ts_ann(ccx, e.id).conditions;
}
@ -344,7 +348,7 @@ fn stmt_pp(ccx: crate_ctxt, s: stmt) -> pre_and_post {
/* fails if b has no annotation */
fn block_pp(ccx: crate_ctxt, b: blk) -> pre_and_post {
log "block_pp";
#debug("block_pp");
ret node_id_to_ts_ann(ccx, b.node.id).conditions;
}
@ -359,7 +363,7 @@ fn clear_precond(ccx: crate_ctxt, id: node_id) {
}
fn block_states(ccx: crate_ctxt, b: blk) -> pre_and_post_state {
log "block_states";
#debug("block_states");
ret node_id_to_ts_ann(ccx, b.node.id).states;
}
@ -420,43 +424,43 @@ fn block_poststate(ccx: crate_ctxt, b: blk) -> poststate {
}
fn set_prestate_ann(ccx: crate_ctxt, id: node_id, pre: prestate) -> bool {
log "set_prestate_ann";
#debug("set_prestate_ann");
ret set_prestate(node_id_to_ts_ann(ccx, id), pre);
}
fn extend_prestate_ann(ccx: crate_ctxt, id: node_id, pre: prestate) -> bool {
log "extend_prestate_ann";
#debug("extend_prestate_ann");
ret extend_prestate(node_id_to_ts_ann(ccx, id).states.prestate, pre);
}
fn set_poststate_ann(ccx: crate_ctxt, id: node_id, post: poststate) -> bool {
log "set_poststate_ann";
#debug("set_poststate_ann");
ret set_poststate(node_id_to_ts_ann(ccx, id), post);
}
fn extend_poststate_ann(ccx: crate_ctxt, id: node_id, post: poststate) ->
bool {
log "extend_poststate_ann";
#debug("extend_poststate_ann");
ret extend_poststate(node_id_to_ts_ann(ccx, id).states.poststate, post);
}
fn set_pre_and_post(ccx: crate_ctxt, id: node_id, pre: precond,
post: postcond) {
log "set_pre_and_post";
#debug("set_pre_and_post");
let t = node_id_to_ts_ann(ccx, id);
set_precondition(t, pre);
set_postcondition(t, post);
}
fn copy_pre_post(ccx: crate_ctxt, id: node_id, sub: @expr) {
log "set_pre_and_post";
#debug("set_pre_and_post");
let p = expr_pp(ccx, sub);
copy_pre_post_(ccx, id, p.precondition, p.postcondition);
}
fn copy_pre_post_(ccx: crate_ctxt, id: node_id, pre: prestate,
post: poststate) {
log "set_pre_and_post";
#debug("set_pre_and_post");
let t = node_id_to_ts_ann(ccx, id);
set_precondition(t, pre);
set_postcondition(t, post);
@ -499,7 +503,7 @@ fn constraints_expr(cx: ty::ctxt, e: @expr) -> [@ty::constr] {
fn node_id_to_def_strict(cx: ty::ctxt, id: node_id) -> def {
alt cx.def_map.find(id) {
none. {
log_err "node_id_to_def: node_id " + int::str(id) + " has no def";
#error("node_id_to_def: node_id %d has no def", id);
fail;
}
some(d) { ret d; }
@ -546,7 +550,8 @@ fn match_args(fcx: fn_ctxt, occs: @mutable [pred_args],
log "match_args: looking at " +
constr_args_to_str(fn (i: inst) -> str { ret i.ident; }, occ);
for pd: pred_args in *occs {
log "match_args: candidate " + pred_args_to_str(pd);
log_full(core::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; }
}
@ -750,7 +755,7 @@ fn replace(subst: subst, d: pred_args) -> [constr_arg_general_<inst>] {
}
}
_ {
// log_err "##";
// #error("##");
rslt += [c.node];
}
}
@ -760,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_err p._0;
log_full(core::error, p._0);
}
case (_) {}
}
@ -975,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_err (res);
log_full(core::error, (res));
res
}
case (_) { false }

View file

@ -158,7 +158,7 @@ fn relax_precond_block(fcx: fn_ctxt, i: node_id, b: blk) {
}
fn gen_poststate(fcx: fn_ctxt, id: node_id, c: tsconstr) -> bool {
log "gen_poststate";
#debug("gen_poststate");
ret set_in_poststate(bit_num(fcx, c),
node_id_to_ts_ann(fcx.ccx, id).states);
}
@ -174,7 +174,7 @@ fn kill_all_prestate(fcx: fn_ctxt, id: node_id) {
fn kill_poststate(fcx: fn_ctxt, id: node_id, c: tsconstr) -> bool {
log "kill_poststate";
#debug("kill_poststate");
ret clear_in_poststate(bit_num(fcx, c),
node_id_to_ts_ann(fcx.ccx, id).states);
}
@ -203,7 +203,7 @@ fn clear_in_poststate_expr(fcx: fn_ctxt, e: @expr, t: poststate) {
}
fn kill_poststate_(fcx: fn_ctxt, c: tsconstr, post: poststate) -> bool {
log "kill_poststate_";
#debug("kill_poststate_");
ret clear_in_poststate_(bit_num(fcx, c), post);
}

View file

@ -74,7 +74,7 @@ fn check_states_stmt(s: @stmt, fcx: fn_ctxt, v: visit::vt<fn_ctxt>) {
log("check_states_stmt:");
log print::pprust::stmt_to_str(*s);
log_full(core::debug, print::pprust::stmt_to_str(*s));
log("prec = ");
log_tritv(fcx, prec);
log("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 "collect_local: pushing " + ident;;
log_full(core::debug, "collect_local: pushing " + ident);;
*cx.cs += [respan(loc.span, ninit(p.id, ident))];
};
visit::visit_local(loc, cx, v);
@ -65,7 +65,8 @@ fn find_locals(tcx: ty::ctxt,
fn add_constraint(tcx: ty::ctxt, c: sp_constr, next: uint, tbl: constr_map) ->
uint {
log constraint_to_str(tcx, c) + " |-> " + uint::str(next);
log_full(core::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)); }
npred(p, d_id, args) {

View file

@ -17,12 +17,12 @@ import syntax::codemap::span;
import util::ppaux::fn_ident_to_string;
fn find_pre_post_mod(_m: _mod) -> _mod {
log "implement find_pre_post_mod!";
#debug("implement find_pre_post_mod!");
fail;
}
fn find_pre_post_native_mod(_m: native_mod) -> native_mod {
log "implement find_pre_post_native_mod";
#debug("implement find_pre_post_native_mod");
fail;
}
@ -86,7 +86,7 @@ fn find_pre_post_item(ccx: crate_ctxt, i: item) {
be the union of all postconditions for <args> */
fn find_pre_post_exprs(fcx: fn_ctxt, args: [@expr], id: node_id) {
if vec::len::<@expr>(args) > 0u {
log "find_pre_post_exprs: oper =";
#debug("find_pre_post_exprs: oper =");
log_expr(*args[0]);
}
fn do_one(fcx: fn_ctxt, e: @expr) { find_pre_post_expr(fcx, e); }
@ -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 ("handle_var_def: ", def, name);
log_full(core::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 ("handle_var_def: def=", def);
log_full(core::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 ("forget_in_postcond: ", cap_item);
log_full(core::debug, ("forget_in_postcond: ", cap_item));
forget_in_postcond(fcx, e.id, cap_item.id);
}
}
@ -565,7 +565,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) {
}
fn find_pre_post_stmt(fcx: fn_ctxt, s: stmt) {
log "stmt =";
#debug("stmt =");
log_stmt(s);
alt s.node {
stmt_decl(adecl, id) {
@ -678,9 +678,9 @@ fn find_pre_post_block(fcx: fn_ctxt, b: blk) {
fn do_one_(fcx: fn_ctxt, s: @stmt) {
find_pre_post_stmt(fcx, *s);
/*
log_err "pre_post for stmt:";
#error("pre_post for stmt:");
log_stmt_err(*s);
log_err "is:";
#error("is:");
log_pp_err(stmt_pp(fcx.ccx, *s));
*/
}

View file

@ -468,7 +468,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
}
expr_while(test, body) {
/*
log_err "in a while loop:";
#error("in a while loop:");
log_expr_err(*e);
aux::log_tritv_err(fcx, block_poststate(fcx.ccx, body));
aux::log_tritv_err(fcx, pres);
@ -476,7 +476,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
let loop_pres =
intersect_states(block_poststate(fcx.ccx, body), pres);
// aux::log_tritv_err(fcx, loop_pres);
// log_err "---------------";
// #error("---------------");
let changed =
set_prestate_ann(fcx.ccx, e.id, loop_pres) |
@ -621,14 +621,14 @@ fn find_pre_post_state_stmt(fcx: fn_ctxt, pres: prestate, s: @stmt) -> bool {
let stmt_ann = stmt_to_ann(fcx.ccx, *s);
/*
log_err ("[" + fcx.name + "]");
log_err "*At beginning: stmt = ";
log_full(core::error, ("[" + fcx.name + "]"));
#error("*At beginning: stmt = ");
log_stmt_err(*s);
log_err "*prestate = ";
#error("*prestate = ");
log_tritv_err(fcx, stmt_ann.states.prestate);
log_err "*poststate =";
#error("*poststate =");
log_tritv_err(fcx, stmt_ann.states.poststate);
log_err "pres = ";
#error("pres = ");
log_tritv_err(fcx, pres);
*/
@ -646,14 +646,14 @@ fn find_pre_post_state_stmt(fcx: fn_ctxt, pres: prestate, s: @stmt) -> bool {
set_poststate(stmt_ann, c_and_p.post) | c_and_p.changed;
/*
log_err "Summary: stmt = ";
#error("Summary: stmt = ");
log_stmt_err(*s);
log_err "prestate = ";
#error("prestate = ");
log_tritv_err(fcx, stmt_ann.states.prestate);
log_err "poststate =";
#error("poststate =");
log_tritv_err(fcx, stmt_ann.states.poststate);
log_err "changed =";
log_err changed;
#error("changed =");
log_full(core::error, changed);
*/
ret changed;
@ -671,7 +671,7 @@ fn find_pre_post_state_stmt(fcx: fn_ctxt, pres: prestate, s: @stmt) -> bool {
set_poststate(stmt_ann, expr_poststate(fcx.ccx, ex));
/*
log_err "Finally:";
#error("Finally:");
log_stmt_err(*s);
log_err("prestate = ");
log_err(bitv::to_str(stmt_ann.states.prestate));
@ -718,16 +718,16 @@ fn find_pre_post_state_block(fcx: fn_ctxt, pres0: prestate, b: blk) -> bool {
/*
log_err "For block:";
#error("For block:");
log_block_err(b);
log_err "poststate = ";
#error("poststate = ");
log_states_err(block_states(fcx.ccx, b));
log_err "pres0:";
#error("pres0:");
log_tritv_err(fcx, pres0);
log_err "post:";
#error("post:");
log_tritv_err(fcx, post);
log_err "changed = ";
log_err changed;
#error("changed = ");
log_full(core::error, changed);
*/
ret changed;
@ -773,8 +773,8 @@ fn find_pre_post_state_fn(fcx: fn_ctxt,
}
/*
log_err "find_pre_post_state_fn";
log_err changed;
#error("find_pre_post_state_fn");
log_full(core::error, changed);
fcx.ccx.tcx.sess.span_note(f_body.span, fcx.name);
*/

View file

@ -1535,7 +1535,7 @@ fn is_pred_ty(cx: ctxt, fty: t) -> bool {
fn ty_var_id(cx: ctxt, typ: t) -> int {
alt struct(cx, typ) {
ty::ty_var(vid) { ret vid; }
_ { log_err "ty_var_id called on non-var ty"; fail; }
_ { #error("ty_var_id called on non-var ty"); fail; }
}
}
@ -2450,7 +2450,7 @@ mod unify {
none. { typespec = ""; }
some(typ) { typespec = " =" + ty_to_str(tcx, typ); }
}
log_err #fmt["set %u:%s%s", i, typespec, sets];
#error("set %u:%s%s", i, typespec, sets);
i += 1u;
}
}

View file

@ -1530,7 +1530,8 @@ fn check_expr_fn_with_unifier(fcx: @fn_ctxt,
fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
expected: ty::t) -> bool {
//log_err "typechecking expr " + syntax::print::pprust::expr_to_str(expr);
#debug("typechecking expr %s",
syntax::print::pprust::expr_to_str(expr));
// A generic function to factor out common logic from call and bind
// expressions.

View file

@ -28,8 +28,8 @@ fn expand_syntax_ext(cx: ext_ctxt, sp: span, arg: @ast::expr,
expr_to_str(cx, args[0],
"first argument to #fmt must be a " + "string literal.");
let fmtspan = args[0].span;
log "Format string:";
log fmt;
#debug("Format string:");
log_full(core::debug, fmt);
fn parse_fmt_err_(cx: ext_ctxt, sp: span, msg: str) -> ! {
cx.span_fatal(sp, msg);
}
@ -252,53 +252,57 @@ 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 "param: " + int::to_str(p, 10u); }
_ { log "param: none"; }
some(p) { log_full(core::debug, "param: " + int::to_str(p, 10u)); }
_ { #debug("param: none"); }
}
for f: flag in c.flags {
alt f {
flag_left_justify. { log "flag: left justify"; }
flag_left_zero_pad. { log "flag: left zero pad"; }
flag_space_for_sign. { log "flag: left space pad"; }
flag_sign_always. { log "flag: sign always"; }
flag_alternate. { log "flag: alternate"; }
flag_left_justify. { #debug("flag: left justify"); }
flag_left_zero_pad. { #debug("flag: left zero pad"); }
flag_space_for_sign. { #debug("flag: left space pad"); }
flag_sign_always. { #debug("flag: sign always"); }
flag_alternate. { #debug("flag: alternate"); }
}
}
alt c.width {
count_is(i) { log "width: count is " + int::to_str(i, 10u); }
count_is(i) { log_full(core::debug,
"width: count is " + int::to_str(i, 10u)); }
count_is_param(i) {
log "width: count is param " + int::to_str(i, 10u);
log_full(core::debug,
"width: count is param " + int::to_str(i, 10u));
}
count_is_next_param. { log "width: count is next param"; }
count_implied. { log "width: count is implied"; }
count_is_next_param. { #debug("width: count is next param"); }
count_implied. { #debug("width: count is implied"); }
}
alt c.precision {
count_is(i) { log "prec: count is " + int::to_str(i, 10u); }
count_is(i) { log_full(core::debug,
"prec: count is " + int::to_str(i, 10u)); }
count_is_param(i) {
log "prec: count is param " + int::to_str(i, 10u);
log_full(core::debug,
"prec: count is param " + int::to_str(i, 10u));
}
count_is_next_param. { log "prec: count is next param"; }
count_implied. { log "prec: count is implied"; }
count_is_next_param. { #debug("prec: count is next param"); }
count_implied. { #debug("prec: count is implied"); }
}
alt c.ty {
ty_bool. { log "type: bool"; }
ty_str. { log "type: str"; }
ty_char. { log "type: char"; }
ty_bool. { #debug("type: bool"); }
ty_str. { #debug("type: str"); }
ty_char. { #debug("type: char"); }
ty_int(s) {
alt s {
signed. { log "type: signed"; }
unsigned. { log "type: unsigned"; }
signed. { #debug("type: signed"); }
unsigned. { #debug("type: unsigned"); }
}
}
ty_bits. { log "type: bits"; }
ty_bits. { #debug("type: bits"); }
ty_hex(cs) {
alt cs {
case_upper. { log "type: uhex"; }
case_lower. { log "type: lhex"; }
case_upper. { #debug("type: uhex"); }
case_lower. { #debug("type: lhex"); }
}
}
ty_octal. { log "type: octal"; }
ty_float. { log "type: float"; }
ty_octal. { #debug("type: octal"); }
ty_float. { #debug("type: float"); }
}
}
let fmt_sp = args[0].span;
@ -318,7 +322,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: [piece], args: [@ast::expr])
"not enough arguments to #fmt " +
"for the given format string");
}
log "Building conversion:";
#debug("Building conversion:");
log_conv(conv);
let arg_expr = args[n];
let c_expr = make_new_conv(cx, fmt_sp, conv, arg_expr);

View file

@ -29,7 +29,7 @@ fn eval_crate_directives(cx: ctx, cdirs: [@ast::crate_directive], prefix: str,
fn eval_crate_directives_to_mod(cx: ctx, cdirs: [@ast::crate_directive],
prefix: str, suffix: option::t<str>)
-> (ast::_mod, [ast::attribute]) {
log #fmt("eval crate prefix: %s", prefix);
#debug("eval crate prefix: %s", prefix);
log #fmt("eval crate suffix: %s",
option::from_maybe("none", suffix));
let (cview_items, citems, cattrs)
@ -72,9 +72,9 @@ fn parse_companion_mod(cx: ctx, prefix: str, suffix: option::t<str>)
}
let modpath = companion_file(prefix, suffix);
log #fmt("looking for companion mod %s", modpath);
#debug("looking for companion mod %s", modpath);
if file_exists(modpath) {
log "found companion mod";
#debug("found companion mod");
let p0 = new_parser_from_file(cx.sess, cx.cfg, modpath,
cx.chpos, cx.byte_pos, SOURCE_FILE);
let inner_attrs = parse_inner_attrs_and_next(p0);

View file

@ -560,7 +560,7 @@ fn consume_non_eol_whitespace(rdr: reader) {
}
fn push_blank_line_comment(rdr: reader, &comments: [cmnt]) {
log ">>> blank-line comment";
#debug(">>> blank-line comment");
let v: [str] = [];
comments += [{style: blank_line, lines: v, pos: rdr.get_chpos()}];
}
@ -575,16 +575,16 @@ fn consume_whitespace_counting_blank_lines(rdr: reader, &comments: [cmnt]) {
}
fn read_line_comments(rdr: reader, code_to_the_left: bool) -> cmnt {
log ">>> line comments";
#debug(">>> line comments");
let p = rdr.get_chpos();
let lines: [str] = [];
while rdr.curr() == '/' && rdr.next() == '/' {
let line = read_one_line_comment(rdr);
log line;
log_full(core::debug, line);
lines += [line];
consume_non_eol_whitespace(rdr);
}
log "<<< line comments";
#debug("<<< line comments");
ret {style: if code_to_the_left { trailing } else { isolated },
lines: lines,
pos: p};
@ -603,12 +603,12 @@ 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 "pushing line: " + s1;
log_full(core::debug, "pushing line: " + s1);
lines += [s1];
}
fn read_block_comment(rdr: reader, code_to_the_left: bool) -> cmnt {
log ">>> block comment";
#debug(">>> block comment");
let p = rdr.get_chpos();
let lines: [str] = [];
let col: uint = rdr.get_col();
@ -617,7 +617,7 @@ fn read_block_comment(rdr: reader, code_to_the_left: bool) -> cmnt {
let curr_line = "/*";
let level: int = 1;
while level > 0 {
log #fmt["=== block comment level %d", level];
#debug("=== block comment level %d", level);
if rdr.is_eof() { rdr.err("unterminated block comment"); fail; }
if rdr.curr() == '\n' {
trim_whitespace_prefix_and_push_line(lines, curr_line, col);
@ -648,7 +648,7 @@ fn read_block_comment(rdr: reader, code_to_the_left: bool) -> cmnt {
if !rdr.is_eof() && rdr.curr() != '\n' && vec::len(lines) == 1u {
style = mixed;
}
log "<<< block comment";
#debug("<<< block comment");
ret {style: style, lines: lines, pos: p};
}
@ -658,13 +658,13 @@ fn peeking_at_comment(rdr: reader) -> bool {
}
fn consume_comment(rdr: reader, code_to_the_left: bool, &comments: [cmnt]) {
log ">>> consume comment";
#debug(">>> consume comment");
if rdr.curr() == '/' && rdr.next() == '/' {
comments += [read_line_comments(rdr, code_to_the_left)];
} else if rdr.curr() == '/' && rdr.next() == '*' {
comments += [read_block_comment(rdr, code_to_the_left)];
} else { fail; }
log "<<< consume comment";
#debug("<<< consume comment");
}
fn is_lit(t: token::token) -> bool {
@ -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 "tok: " + token::to_str(rdr, tok.tok);
log_full(core::debug, "tok: " + token::to_str(rdr, tok.tok));
first_read = false;
}
ret {cmnts: comments, lits: literals};

View file

@ -101,7 +101,7 @@ fn mk_printer(out: io::writer, linewidth: uint) -> printer {
// fall behind.
let n: uint = 3u * linewidth;
log #fmt["mk_printer %u", linewidth];
#debug("mk_printer %u", linewidth);
let token: [mutable token] = vec::init_elt_mut(EOF, n);
let size: [mutable int] = vec::init_elt_mut(0, n);
let scan_stack: [mutable uint] = vec::init_elt_mut(0u, n);
@ -241,7 +241,7 @@ obj printer(out: io::writer,
fn replace_last_token(t: token) { token[right] = t; }
fn pretty_print(t: token) {
log #fmt["pp [%u,%u]", left, right];
#debug("pp [%u,%u]", left, right);
alt t {
EOF. {
if !scan_stack_empty {
@ -257,17 +257,17 @@ obj printer(out: io::writer,
left = 0u;
right = 0u;
} else { self.advance_right(); }
log #fmt["pp BEGIN/buffer [%u,%u]", left, right];
#debug("pp BEGIN/buffer [%u,%u]", left, right);
token[right] = t;
size[right] = -right_total;
self.scan_push(right);
}
END. {
if scan_stack_empty {
log #fmt["pp END/print [%u,%u]", left, right];
#debug("pp END/print [%u,%u]", left, right);
self.print(t, 0);
} else {
log #fmt["pp END/buffer [%u,%u]", left, right];
#debug("pp END/buffer [%u,%u]", left, right);
self.advance_right();
token[right] = t;
size[right] = -1;
@ -281,7 +281,7 @@ obj printer(out: io::writer,
left = 0u;
right = 0u;
} else { self.advance_right(); }
log #fmt["pp BREAK/buffer [%u,%u]", left, right];
#debug("pp BREAK/buffer [%u,%u]", left, right);
self.check_stack(0);
self.scan_push(right);
token[right] = t;
@ -290,10 +290,10 @@ obj printer(out: io::writer,
}
STRING(s, len) {
if scan_stack_empty {
log #fmt["pp STRING/print [%u,%u]", left, right];
#debug("pp STRING/print [%u,%u]", left, right);
self.print(t, len);
} else {
log #fmt["pp STRING/buffer [%u,%u]", left, right];
#debug("pp STRING/buffer [%u,%u]", left, right);
self.advance_right();
token[right] = t;
size[right] = len;
@ -311,7 +311,7 @@ obj printer(out: io::writer,
right_total - left_total, space];
if !scan_stack_empty {
if left == scan_stack[bottom] {
log #fmt["setting %u to infinity and popping", left];
#debug("setting %u to infinity and popping", left);
size[self.scan_pop_bottom()] = size_infinity;
}
}
@ -320,7 +320,7 @@ obj printer(out: io::writer,
}
}
fn scan_push(x: uint) {
log #fmt["scan_push %u", x];
#debug("scan_push %u", x);
if scan_stack_empty {
scan_stack_empty = false;
} else { top += 1u; top %= buf_len; assert (top != bottom); }
@ -349,7 +349,7 @@ obj printer(out: io::writer,
assert (right != left);
}
fn advance_left(x: token, L: int) {
log #fmt["advnce_left [%u,%u], sizeof(%u)=%d", left, right, left, L];
#debug("advnce_left [%u,%u], sizeof(%u)=%d", left, right, left, L);
if L >= 0 {
self.print(x, L);
alt x {
@ -388,13 +388,13 @@ obj printer(out: io::writer,
}
}
fn print_newline(amount: int) {
log #fmt["NEWLINE %d", amount];
#debug("NEWLINE %d", amount);
out.write_str("\n");
pending_indentation = 0;
self.indent(amount);
}
fn indent(amount: int) {
log #fmt["INDENT %d", amount];
#debug("INDENT %d", amount);
pending_indentation += amount;
}
fn top() -> print_stack_elt {
@ -413,20 +413,20 @@ obj printer(out: io::writer,
fn print(x: token, L: int) {
log #fmt["print %s %d (remaining line space=%d)", tok_str(x), L,
space];
log buf_str(token, size, left, right, 6u);
log_full(core::debug, buf_str(token, size, left, right, 6u));
alt x {
BEGIN(b) {
if L > space {
let col = margin - space + b.offset;
log #fmt["print BEGIN -> push broken block at col %d", col];
#debug("print BEGIN -> push broken block at col %d", col);
print_stack += [{offset: col, pbreak: broken(b.breaks)}];
} else {
log "print BEGIN -> push fitting block";
#debug("print BEGIN -> push fitting block");
print_stack += [{offset: 0, pbreak: fits}];
}
}
END. {
log "print END -> pop END";
#debug("print END -> pop END");
assert (vec::len(print_stack) != 0u);
vec::pop(print_stack);
}
@ -434,22 +434,22 @@ obj printer(out: io::writer,
let top = self.top();
alt top.pbreak {
fits. {
log "print BREAK in fitting block";
#debug("print BREAK in fitting block");
space -= b.blank_space;
self.indent(b.blank_space);
}
broken(consistent.) {
log "print BREAK in consistent block";
#debug("print BREAK in consistent block");
self.print_newline(top.offset + b.offset);
space = margin - (top.offset + b.offset);
}
broken(inconsistent.) {
if L > space {
log "print BREAK w/ newline in inconsistent";
#debug("print BREAK w/ newline in inconsistent");
self.print_newline(top.offset + b.offset);
space = margin - (top.offset + b.offset);
} else {
log "print BREAK w/o newline in inconsistent";
#debug("print BREAK w/o newline in inconsistent");
self.indent(b.blank_space);
space -= b.blank_space;
}
@ -457,7 +457,7 @@ obj printer(out: io::writer,
}
}
STRING(s, len) {
log "print STRING";
#debug("print STRING");
assert (L == len);
// assert L <= space;

View file

@ -35,31 +35,49 @@ fn field_exprs(fields: [ast::field]) -> [@ast::expr] {
ret es;
}
fn log_expr(e: ast::expr) { log print::pprust::expr_to_str(@e); }
fn log_expr(e: ast::expr) {
log_full(core::debug, print::pprust::expr_to_str(@e));
}
fn log_expr_err(e: ast::expr) { log_err print::pprust::expr_to_str(@e); }
fn log_expr_err(e: ast::expr) {
log_full(core::error, print::pprust::expr_to_str(@e));
}
fn log_ty_err(t: @ty) { log_err print::pprust::ty_to_str(t); }
fn log_ty_err(t: @ty) {
log_full(core::error, print::pprust::ty_to_str(t));
}
fn log_pat_err(p: @pat) { log_err print::pprust::pat_to_str(p); }
fn log_pat_err(p: @pat) {
log_full(core::error, print::pprust::pat_to_str(p));
}
fn log_block(b: ast::blk) { log print::pprust::block_to_str(b); }
fn log_block(b: ast::blk) {
log_full(core::debug, print::pprust::block_to_str(b));
}
fn log_block_err(b: ast::blk) { log_err print::pprust::block_to_str(b); }
fn log_block_err(b: ast::blk) {
log_full(core::error, print::pprust::block_to_str(b));
}
fn log_item_err(i: @ast::item) { log_err print::pprust::item_to_str(i); }
fn log_item_err(i: @ast::item) {
log_full(core::error, print::pprust::item_to_str(i));
}
fn log_fn(f: ast::_fn, name: ast::ident, params: [ast::ty_param]) {
log print::pprust::fun_to_str(f, name, params);
log_full(core::debug, print::pprust::fun_to_str(f, name, params));
}
fn log_fn_err(f: ast::_fn, name: ast::ident, params: [ast::ty_param]) {
log_err print::pprust::fun_to_str(f, name, params);
log_full(core::error, print::pprust::fun_to_str(f, name, params));
}
fn log_stmt(st: ast::stmt) { log print::pprust::stmt_to_str(st); }
fn log_stmt(st: ast::stmt) {
log_full(core::debug, print::pprust::stmt_to_str(st));
}
fn log_stmt_err(st: ast::stmt) { log_err print::pprust::stmt_to_str(st); }
fn log_stmt_err(st: ast::stmt) {
log_full(core::error, print::pprust::stmt_to_str(st));
}
fn has_nonlocal_exits(b: ast::blk) -> bool {
let has_exits = @mutable false;

View file

@ -50,22 +50,22 @@ fn mk_filesearch(maybe_sysroot: option::t<fs::path>,
}
let sysroot = get_sysroot(maybe_sysroot);
log #fmt("using sysroot = %s", sysroot);
#debug("using sysroot = %s", sysroot);
ret filesearch_impl(sysroot, addl_lib_search_paths, target_triple);
}
// FIXME #1001: This can't be an obj method
fn search<copy T>(filesearch: filesearch, pick: pick<T>) -> option::t<T> {
for lib_search_path in filesearch.lib_search_paths() {
log #fmt["searching %s", lib_search_path];
#debug("searching %s", lib_search_path);
for path in fs::list_dir(lib_search_path) {
log #fmt["testing %s", path];
#debug("testing %s", path);
let maybe_picked = pick(path);
if option::is_some(maybe_picked) {
log #fmt("picked %s", path);
#debug("picked %s", path);
ret maybe_picked;
} else {
log #fmt("rejected %s", path);
#debug("rejected %s", path);
}
}
}