syntax: Refactor diagnostics to focus on Writers

This commit alters the diagnostic emission machinery to be focused around a
Writer for emitting errors. This allows it to not hard-code emission of errors
to stderr (useful for other applications).
This commit is contained in:
Alex Crichton 2014-02-28 11:37:04 -08:00
parent 9b1be3d182
commit 324547140e
5 changed files with 122 additions and 111 deletions

View file

@ -14,7 +14,7 @@
use ast;
use codemap::{Span, CodeMap, FileMap};
use codemap;
use diagnostic::{SpanHandler, mk_span_handler, mk_handler};
use diagnostic::{SpanHandler, mk_span_handler, default_handler};
use parse::attr::ParserAttr;
use parse::parser::Parser;
@ -49,7 +49,7 @@ pub fn new_parse_sess() -> @ParseSess {
let cm = @CodeMap::new();
@ParseSess {
cm: cm,
span_diagnostic: mk_span_handler(mk_handler(), cm),
span_diagnostic: mk_span_handler(default_handler(), cm),
included_mod_stack: RefCell::new(~[]),
}
}