mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Centralize a bit invalid value error reporting.
Also, buffer the errors, since we're going to want to look at the whole declaration block to skip reporting them. This shouldn't change behavior, just moves some work to the caller, and defers a bit the work so that it happens only when error reporting is enabled. Differential Revision: https://phabricator.services.mozilla.com/D30200
This commit is contained in:
parent
29cecf65b8
commit
02210264e7
3 changed files with 87 additions and 43 deletions
|
@ -136,6 +136,12 @@ impl<'a> ParserContext<'a> {
|
|||
.expect("Rule type expected, but none was found.")
|
||||
}
|
||||
|
||||
/// Returns whether CSS error reporting is enabled.
|
||||
#[inline]
|
||||
pub fn error_reporting_enabled(&self) -> bool {
|
||||
self.error_reporter.is_some()
|
||||
}
|
||||
|
||||
/// Record a CSS parse error with this context’s error reporting.
|
||||
pub fn log_css_error(&self, location: SourceLocation, error: ContextualParseError) {
|
||||
let error_reporter = match self.error_reporter {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue