Rewrite session formatting to use #fmt extension.

This commit is contained in:
Graydon Hoare 2010-10-18 16:03:22 -07:00
parent 68321b0de8
commit f747101b7c

View File

@ -3,33 +3,21 @@ import std._uint;
obj session() {
fn span_err(span sp, str msg) {
let str s = sp.filename;
s += ':' as u8;
// We really need #fmt soon!
s += _uint.to_str(sp.lo.line, 10u);
s += ':' as u8;
s += _uint.to_str(sp.lo.col, 10u);
s += ':' as u8;
s += _uint.to_str(sp.hi.line, 10u);
s += ':' as u8;
s += _uint.to_str(sp.hi.col, 10u);
s += ": error: ";
s += msg;
log s;
log #fmt("%s:%u:%u:%u:%u: error: %s",
sp.filename,
sp.lo.line, sp.lo.col,
sp.hi.line, sp.hi.col,
msg);
fail;
}
fn err(str msg) {
let str s = "error: ";
s += msg;
log s;
log #fmt("error: %s", msg);
fail;
}
fn unimpl(str msg) {
let str s = "error: unimplemented ";
s += msg;
log s;
log #fmt("error: unimplemented %s", msg);
fail;
}
}