@@ -231,7 +231,7 @@ pub fn emit(cmsp: Option<(@codemap::CodeMap, span)>, msg: &str, lvl: level) {
231
231
let ss = cm. span_to_str ( sp) ;
232
232
let lines = cm. span_to_lines ( sp) ;
233
233
print_diagnostic ( ss, lvl, msg) ;
234
- highlight_lines ( cm, sp, lines) ;
234
+ highlight_lines ( cm, sp, lvl , lines) ;
235
235
print_macro_backtrace ( cm, sp) ;
236
236
}
237
237
None => {
@@ -241,7 +241,7 @@ pub fn emit(cmsp: Option<(@codemap::CodeMap, span)>, msg: &str, lvl: level) {
241
241
}
242
242
243
243
fn highlight_lines( cm : @codemap:: CodeMap ,
244
- sp : span ,
244
+ sp : span , lvl : level ,
245
245
lines : @codemap:: FileLines ) {
246
246
let fm = lines. file ;
247
247
@@ -293,18 +293,18 @@ fn highlight_lines(cm: @codemap::CodeMap,
293
293
let curChar = ( orig[ pos] as char) ;
294
294
s += match curChar { // Whenever a tab occurs on the previous
295
295
'\t' => "\t " , // line, we insert one on the error-point-
296
- _ => " " // -squigly -line as well (instead of a
297
- }; // space). This way the squigly -line will
296
+ _ => " " // -squiggly -line as well (instead of a
297
+ }; // space). This way the squiggly -line will
298
298
} // usually appear in the correct position.
299
299
io::stderr().write_str(s);
300
300
let mut s = ~" ^";
301
301
let hi = cm. lookup_char_pos( sp. hi) ;
302
302
if hi. col != lo. col {
303
303
// the ^ already takes up one space
304
- let num_squiglies = hi. col. to_uint( ) -lo. col. to_uint( ) -1 u;
305
- for num_squiglies . times( ) { s += "~" ; }
304
+ let num_squigglies = hi. col. to_uint( ) -lo. col. to_uint( ) -1 u;
305
+ for num_squigglies . times( ) { s += "~" ; }
306
306
}
307
- print_maybe_colored( s + "\n " , term :: color_bright_green ) ;
307
+ print_maybe_colored( s + "\n " , diagnosticcolor ( lvl ) ) ;
308
308
}
309
309
}
310
310
0 commit comments