about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-01-13 18:35:16 -0800
committerBrian Anderson <banderson@mozilla.com>2012-01-13 22:07:55 -0800
commitdbf6ed922155cad7306dc4f93e1951e2f35443ab (patch)
tree4f6c1e9e9a2e296a5b0529f846c1d553bf6fe7f9
parent1a6383a0eba48c65e8e7926100a2c5b244d97a43 (diff)
rustc: Remove emit_fatal/error/warning/note functions
-rw-r--r--src/comp/driver/diagnostic.rs34
-rw-r--r--src/comp/driver/driver.rs2
2 files changed, 12 insertions, 24 deletions
diff --git a/src/comp/driver/diagnostic.rs b/src/comp/driver/diagnostic.rs
index 261a934f3a6..e1c360daf12 100644
--- a/src/comp/driver/diagnostic.rs
+++ b/src/comp/driver/diagnostic.rs
@@ -3,7 +3,8 @@ import io::writer_util;
 import syntax::codemap;
 import codemap::span;
 
-export emit_warning, emit_error, emit_note;
+export emit_diagnostic;
+export diagnostictype, fatal, error, warning, note;
 export handler, mk_codemap_handler;
 
 iface handler {
@@ -30,19 +31,19 @@ type codemap_t = @{
 
 impl codemap_handler of handler for codemap_t {
     fn span_fatal(sp: span, msg: str) -> ! {
-        emit_fatal(some((self.cm, sp)), msg);
+        emit_diagnostic(some((self.cm, sp)), msg, fatal);
         fail;
     }
     fn fatal(msg: str) -> ! {
-        emit_fatal(none, msg);
+        emit_diagnostic(none, msg, fatal);
         fail;
     }
     fn span_err(sp: span, msg: str) {
-        emit_error(some((self.cm, sp)), msg);
+        emit_diagnostic(some((self.cm, sp)), msg, error);
         self.err_count += 1u;
     }
     fn err(msg: str) {
-        emit_error(none, msg);
+        emit_diagnostic(none, msg, error);
         self.err_count += 1u;
     }
     fn has_errors() -> bool { self.err_count > 0u }
@@ -52,16 +53,16 @@ impl codemap_handler of handler for codemap_t {
         }
     }
     fn span_warn(sp: span, msg: str) {
-        emit_warning(some((self.cm, sp)), msg);
+        emit_diagnostic(some((self.cm, sp)), msg, warning);
     }
     fn warn(msg: str) {
-        emit_warning(none, msg);
+        emit_diagnostic(none, msg, warning);
     }
     fn span_note(sp: span, msg: str) {
-        emit_note(some((self.cm, sp)), msg);
+        emit_diagnostic(some((self.cm, sp)), msg, note);
     }
     fn note(msg: str) {
-        emit_note(none, msg);
+        emit_diagnostic(none, msg, note);
     }
     fn span_bug(sp: span, msg: str) -> ! {
         self.span_fatal(sp, #fmt["internal compiler error %s", msg]);
@@ -148,7 +149,7 @@ fn highlight_lines(cm: codemap::codemap, sp: span,
     let file = alt io::read_whole_file_str(lines.name) {
       result::ok(file) { file }
       result::err(e) {
-        emit_error(none, e);
+        emit_diagnostic(none, e, fatal);
         fail;
       }
     };
@@ -204,16 +205,3 @@ fn highlight_lines(cm: codemap::codemap, sp: span,
         io::stdout().write_str(s + "\n");
     }
 }
-
-fn emit_fatal(cmsp: option<(codemap::codemap, span)>, msg: str) {
-    emit_diagnostic(cmsp, msg, fatal);
-}
-fn emit_error(cmsp: option<(codemap::codemap, span)>, msg: str) {
-    emit_diagnostic(cmsp, msg, error);
-}
-fn emit_warning(cmsp: option<(codemap::codemap, span)>, msg: str) {
-    emit_diagnostic(cmsp, msg, warning);
-}
-fn emit_note(cmsp: option<(codemap::codemap, span)>, msg: str) {
-    emit_diagnostic(cmsp, msg, note);
-}
diff --git a/src/comp/driver/driver.rs b/src/comp/driver/driver.rs
index 2e5807ce2d1..278ffb9b605 100644
--- a/src/comp/driver/driver.rs
+++ b/src/comp/driver/driver.rs
@@ -585,7 +585,7 @@ fn build_output_filenames(ifile: str,
 }
 
 fn early_error(msg: str) -> ! {
-    diagnostic::emit_error(none, msg);
+    diagnostic::emit_diagnostic(none, msg, diagnostic::fatal);
     fail;
 }