move panictry! to where it is used.
This commit is contained in:
parent
10a52c25ca
commit
d7f6ba83fc
@ -31,23 +31,6 @@ mod tests;
|
||||
|
||||
pub const MACRO_ARGUMENTS: Option<&'static str> = Some("macro arguments");
|
||||
|
||||
// A variant of 'panictry!' that works on a Vec<Diagnostic> instead of a single DiagnosticBuilder.
|
||||
macro_rules! panictry_buffer {
|
||||
($handler:expr, $e:expr) => ({
|
||||
use std::result::Result::{Ok, Err};
|
||||
use errors::FatalError;
|
||||
match $e {
|
||||
Ok(e) => e,
|
||||
Err(errs) => {
|
||||
for e in errs {
|
||||
$handler.emit_diagnostic(&e);
|
||||
}
|
||||
FatalError.raise()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! unwrap_or {
|
||||
($opt:expr, $default:expr) => {
|
||||
|
@ -59,6 +59,23 @@ pub enum DirectoryOwnership {
|
||||
// uses a HOF to parse anything, and <source> includes file and
|
||||
// `source_str`.
|
||||
|
||||
/// A variant of 'panictry!' that works on a Vec<Diagnostic> instead of a single DiagnosticBuilder.
|
||||
macro_rules! panictry_buffer {
|
||||
($handler:expr, $e:expr) => ({
|
||||
use std::result::Result::{Ok, Err};
|
||||
use errors::FatalError;
|
||||
match $e {
|
||||
Ok(e) => e,
|
||||
Err(errs) => {
|
||||
for e in errs {
|
||||
$handler.emit_diagnostic(&e);
|
||||
}
|
||||
FatalError.raise()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn parse_crate_from_file<'a>(input: &Path, sess: &'a ParseSess) -> PResult<'a, ast::Crate> {
|
||||
let mut parser = new_parser_from_file(sess, input);
|
||||
parser.parse_crate_mod()
|
||||
|
Loading…
x
Reference in New Issue
Block a user