mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:18:12 +00:00
LibJS: Include source location hint in Parser::print_errors()
This commit is contained in:
parent
28552f3f36
commit
abd49c174a
2 changed files with 8 additions and 2 deletions
|
@ -143,8 +143,12 @@ public:
|
|||
const Vector<Error>& errors() const { return m_parser_state.m_errors; }
|
||||
void print_errors() const
|
||||
{
|
||||
for (auto& error : m_parser_state.m_errors)
|
||||
fprintf(stderr, "SyntaxError: %s\n", error.to_string().characters());
|
||||
for (auto& error : m_parser_state.m_errors) {
|
||||
auto hint = error.source_location_hint(m_parser_state.m_lexer.source());
|
||||
if (!hint.is_empty())
|
||||
warnln("{}", hint);
|
||||
warnln("SyntaxError: {}", error.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue