Use the current parser location for CSS error

… rather than the start location of the current construct.
This likely places the error just *after* of the unexpected token
whereas before would be best, but that’s likely a much bigger change.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1378861
This commit is contained in:
Simon Sapin 2017-09-21 01:44:53 +02:00
parent bc0903c928
commit 056e599562
10 changed files with 34 additions and 31 deletions

View file

@ -1035,7 +1035,6 @@ pub fn parse_one_declaration_into<R>(declarations: &mut SourcePropertyDeclaratio
let mut input = ParserInput::new(input);
let mut parser = Parser::new(&mut input);
let start_position = parser.position();
let start_location = parser.current_source_location();
parser.parse_entirely(|parser| {
let name = id.name().into();
PropertyDeclaration::parse_into(declarations, id, name, &context, parser)
@ -1044,7 +1043,7 @@ pub fn parse_one_declaration_into<R>(declarations: &mut SourcePropertyDeclaratio
let error = ContextualParseError::UnsupportedPropertyDeclaration(
parser.slice_from(start_position), err);
let error_context = ParserErrorContext { error_reporter: error_reporter };
context.log_css_error(&error_context, start_location, error);
context.log_css_error(&error_context, parser.current_source_location(), error);
})
}
@ -1133,7 +1132,8 @@ pub fn parse_property_declaration_list<R>(context: &ParserContext,
}
let error = ContextualParseError::UnsupportedPropertyDeclaration(err.slice, err.error);
context.log_css_error(error_context, err.location, error);
let location = iter.input.current_source_location();
context.log_css_error(error_context, location, error);
}
}
}