style: Move the error reporter into ParserContext.

Summary:
This should make it easier to report errors, and also reduce codesize.

The reason this was so generic is that error reporting was unconditionally
enabled and was super-hot, but now that's no longer the case after bug 1452143,
so we can afford the virtual call in the "error reporting enabled" case.

This opens the possibility of simplifying a lot the error setup as well, though
this patch doesn't do it.

Test Plan: No behavior change, so no new tests.

Reviewers: xidorn

Bug #: 1469957

Differential Revision: https://phabricator.services.mozilla.com/D1734

MozReview-Commit-ID: F3wTdhX9MB5
This commit is contained in:
Emilio Cobos Álvarez 2018-06-20 21:07:45 +02:00
parent bab7be63b2
commit 3a0c3224b9
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
13 changed files with 128 additions and 194 deletions

View file

@ -249,17 +249,3 @@ impl ParseErrorReporter for RustLogReporter {
}
}
}
/// Error reporter which silently forgets errors
pub struct NullReporter;
impl ParseErrorReporter for NullReporter {
fn report_error(
&self,
_url: &UrlExtraData,
_location: SourceLocation,
_error: ContextualParseError,
) {
// do nothing
}
}