Skip to content

Commit

Permalink
Fix shorthand parsing pushing declarations when parse_entirely return…
Browse files Browse the repository at this point in the history
…s Err
  • Loading branch information
SimonSapin committed Jul 13, 2017
1 parent 66c357f commit 3d3c196
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/style/properties/helpers.mako.rs
Expand Up @@ -827,7 +827,7 @@
pub fn parse_into<'i, 't>(declarations: &mut SourcePropertyDeclaration,
context: &ParserContext, input: &mut Parser<'i, 't>)
-> Result<(), ParseError<'i>> {
parse_value(context, input).map(|longhands| {
input.parse_entirely(|input| parse_value(context, input)).map(|longhands| {
% for sub_property in shorthand.sub_properties:
declarations.push(PropertyDeclaration::${sub_property.camel_case}(
longhands.${sub_property.ident}
Expand Down
5 changes: 3 additions & 2 deletions components/style/properties/properties.mako.rs
Expand Up @@ -1553,8 +1553,9 @@ impl PropertyDeclaration {
} else {
input.look_for_var_functions();
let start = input.position();
input.parse_entirely(|input| id.parse_into(declarations, context, input))
.or_else(|_| {
// Not using parse_entirely here: each ${shorthand.ident}::parse_into function
// needs to do so *before* pushing to `declarations`.
id.parse_into(declarations, context, input).or_else(|_| {
while let Ok(_) = input.next() {} // Look for var() after the error.
if input.seen_var_functions() {
input.reset(start);
Expand Down

0 comments on commit 3d3c196

Please sign in to comment.