diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-01-13 15:41:13 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-01-13 15:52:03 -0800 |
| commit | f26266e03de70641296c26c20add33c1c4132ea4 (patch) | |
| tree | 572e4fa4ba9cb8dc17fb2772e1ca5bc4c60d288f /src/comp/syntax/parse | |
| parent | f535940bd55f8d659a5a26370665c5567c6ba55e (diff) | |
rustc: Refactor codemap::emit_* functions
A codemap is only needed when we have a span so put them both into the option.
Diffstat (limited to 'src/comp/syntax/parse')
| -rw-r--r-- | src/comp/syntax/parse/lexer.rs | 4 | ||||
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 9 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs index b0b1cd76d87..cb247e12a40 100644 --- a/src/comp/syntax/parse/lexer.rs +++ b/src/comp/syntax/parse/lexer.rs @@ -47,8 +47,8 @@ impl reader for reader { } else { self.curr = -1 as char; } } fn err(m: str) { - codemap::emit_error(some(ast_util::mk_sp(self.chpos, self.chpos)), - m, self.cm); + codemap::emit_error( + some((self.cm, ast_util::mk_sp(self.chpos, self.chpos))), m); } } diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 3aa56d66917..ad8eb0d5175 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -71,11 +71,11 @@ impl parser for parser { self.span_fatal(self.span, m); } fn span_fatal(sp: span, m: str) -> ! { - codemap::emit_error(some(sp), m, self.sess.cm); + codemap::emit_error(some((self.sess.cm, sp)), m); fail; } fn warn(m: str) { - codemap::emit_warning(some(self.span), m, self.sess.cm); + codemap::emit_warning(some((self.sess.cm, self.span)), m); } fn get_str(i: token::str_num) -> str { interner::get(*self.reader.interner, i) @@ -92,7 +92,7 @@ fn new_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, path: str, src } result::err(e) { - codemap::emit_error(none, e, sess.cm); + codemap::emit_error(none, e); fail; } }; @@ -2525,8 +2525,7 @@ fn parse_crate_from_file(input: str, cfg: ast::crate_cfg, sess: parse_sess) -> } else if str::ends_with(input, ".rs") { parse_crate_from_source_file(input, cfg, sess) } else { - codemap::emit_error(none, "unknown input file type: " + input, - sess.cm); + codemap::emit_error(none, "unknown input file type: " + input); fail } } |
