Skip to content

Commit ad77dd9

Browse files
committed
---
yaml --- r: 2796 b: refs/heads/master c: 97e0575 h: refs/heads/master v: v3
1 parent e669c9b commit ad77dd9

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 79693fab1f6bbcb839c54cf25925fcd216db41c8
2+
refs/heads/master: 97e0575e2ea72a6fdf7a89408611d950bb9c2833

trunk/src/comp/driver/session.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,16 @@ type options = rec(bool shared,
4141
type crate_metadata = rec(str name,
4242
vec[u8] data);
4343

44-
fn emit_diagnostic(span sp, str msg, str kind, u8 color,
45-
codemap::codemap cm) {
44+
fn span_to_str(span sp, codemap::codemap cm) -> str {
4645
auto lo = codemap::lookup_pos(cm, sp.lo);
4746
auto hi = codemap::lookup_pos(cm, sp.hi);
48-
io::stdout().write_str(#fmt("%s:%u:%u:%u:%u: ", lo.filename, lo.line,
49-
lo.col, hi.line, hi.col));
47+
ret (#fmt("%s:%u:%u:%u:%u", lo.filename, lo.line,
48+
lo.col, hi.line, hi.col));
49+
}
50+
51+
fn emit_diagnostic(span sp, str msg, str kind, u8 color,
52+
codemap::codemap cm) {
53+
io::stdout().write_str(span_to_str(sp, cm) + ": ");
5054

5155
if (term::color_supported()) {
5256
term::fg(io::stdout().get_buf_writer(), color);
@@ -143,6 +147,10 @@ state obj session(ast::crate_num cnum,
143147
fn lookup_pos(uint pos) -> codemap::loc {
144148
ret codemap::lookup_pos(cm, pos);
145149
}
150+
151+
fn span_str(span sp) -> str {
152+
ret span_to_str(sp, self.get_codemap());
153+
}
146154
}
147155

148156

0 commit comments

Comments
 (0)