mirror of
https://github.com/servo/servo.git
synced 2025-06-21 15:49:04 +01:00
style: Clear last_parsed_property_id right after successfully parsing the value.
Rather than waiting until parsing another id (successfully or unsuccessfully). If we error before we even get to PropertyId::parse, we'd incorrectly associate the error with the wrong property, incorrectly omitting it sometimes. Differential Revision: https://phabricator.services.mozilla.com/D78260
This commit is contained in:
parent
685e749cfc
commit
3884328ce3
1 changed files with 4 additions and 1 deletions
|
@ -1347,7 +1347,6 @@ impl<'a, 'b, 'i> DeclarationParser<'i> for PropertyDeclarationParser<'a, 'b> {
|
||||||
let id = match PropertyId::parse(&name, self.context) {
|
let id = match PropertyId::parse(&name, self.context) {
|
||||||
Ok(id) => id,
|
Ok(id) => id,
|
||||||
Err(..) => {
|
Err(..) => {
|
||||||
self.last_parsed_property_id = None;
|
|
||||||
return Err(input.new_custom_error(StyleParseErrorKind::UnknownProperty(name)));
|
return Err(input.new_custom_error(StyleParseErrorKind::UnknownProperty(name)));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1469,6 +1468,10 @@ pub fn parse_property_declaration_list(
|
||||||
match declaration {
|
match declaration {
|
||||||
Ok(importance) => {
|
Ok(importance) => {
|
||||||
block.extend(iter.parser.declarations.drain(), importance);
|
block.extend(iter.parser.declarations.drain(), importance);
|
||||||
|
// We've successfully parsed a declaration, so forget about
|
||||||
|
// `last_parsed_property_id`. It'd be wrong to associate any
|
||||||
|
// following error with this property.
|
||||||
|
iter.parser.last_parsed_property_id = None;
|
||||||
},
|
},
|
||||||
Err((error, slice)) => {
|
Err((error, slice)) => {
|
||||||
iter.parser.declarations.clear();
|
iter.parser.declarations.clear();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue