diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-01-13 22:11:29 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-01-14 15:14:43 -0800 |
| commit | 876e9fdc06563af60e1213f3e29cc325331e2a3d (patch) | |
| tree | 32355cffa87719a30deb75131d02fc1a91733a7a /src/comp | |
| parent | 824beb4c3b5c1bcd12ce7aaa21b1d82dc408d475 (diff) | |
| download | rust-876e9fdc06563af60e1213f3e29cc325331e2a3d.tar.gz rust-876e9fdc06563af60e1213f3e29cc325331e2a3d.zip | |
rustc: Rename diagnostic::diagnostictype to 'level'
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/driver/diagnostic.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/comp/driver/diagnostic.rs b/src/comp/driver/diagnostic.rs index 2ad738f8d96..2536e5ebe16 100644 --- a/src/comp/driver/diagnostic.rs +++ b/src/comp/driver/diagnostic.rs @@ -4,11 +4,11 @@ import syntax::codemap; import codemap::span; export emitter, emit_diagnostic; -export diagnostictype, fatal, error, warning, note; +export level, fatal, error, warning, note; export handler, mk_codemap_handler; type emitter = fn@(cmsp: option<(codemap::codemap, span)>, - msg: str, t: diagnostictype); + msg: str, lvl: level); iface handler { @@ -88,7 +88,7 @@ fn mk_codemap_handler(cm: codemap::codemap, some(e) { e } none. { let f = fn@(cmsp: option<(codemap::codemap, span)>, - msg: str, t: diagnostictype) { + msg: str, t: level) { emit_diagnostic(cmsp, msg, t); }; f @@ -102,15 +102,15 @@ fn mk_codemap_handler(cm: codemap::codemap, } as handler } -tag diagnostictype { +tag level { fatal; error; warning; note; } -fn diagnosticstr(t: diagnostictype) -> str { - alt t { +fn diagnosticstr(lvl: level) -> str { + alt lvl { fatal. { "error" } error. { "error" } warning. { "warning" } @@ -118,8 +118,8 @@ fn diagnosticstr(t: diagnostictype) -> str { } } -fn diagnosticcolor(t: diagnostictype) -> u8 { - alt t { +fn diagnosticcolor(lvl: level) -> u8 { + alt lvl { fatal. { term::color_bright_red } error. { term::color_bright_red } warning. { term::color_bright_yellow } @@ -127,14 +127,14 @@ fn diagnosticcolor(t: diagnostictype) -> u8 { } } -fn print_diagnostic(topic: str, t: diagnostictype, msg: str) { +fn print_diagnostic(topic: str, lvl: level, msg: str) { if str::is_not_empty(topic) { io::stdout().write_str(#fmt["%s ", topic]); } if term::color_supported() { - term::fg(io::stdout(), diagnosticcolor(t)); + term::fg(io::stdout(), diagnosticcolor(lvl)); } - io::stdout().write_str(#fmt["%s:", diagnosticstr(t)]); + io::stdout().write_str(#fmt["%s:", diagnosticstr(lvl)]); if term::color_supported() { term::reset(io::stdout()); } @@ -142,16 +142,16 @@ fn print_diagnostic(topic: str, t: diagnostictype, msg: str) { } fn emit_diagnostic(cmsp: option<(codemap::codemap, span)>, - msg: str, t: diagnostictype) { + msg: str, lvl: level) { alt cmsp { some((cm, sp)) { let ss = codemap::span_to_str(sp, cm); let lines = codemap::span_to_lines(sp, cm); - print_diagnostic(ss, t, msg); + print_diagnostic(ss, lvl, msg); highlight_lines(cm, sp, lines); } none. { - print_diagnostic("", t, msg); + print_diagnostic("", lvl, msg); } } } |
