mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:57:35 +00:00
LibJS: Use message from invalid token in syntax error
This commit is contained in:
parent
6a3389cec6
commit
7112031bfb
1 changed files with 4 additions and 1 deletions
|
@ -1917,7 +1917,10 @@ Token Parser::consume_and_validate_numeric_literal()
|
||||||
|
|
||||||
void Parser::expected(const char* what)
|
void Parser::expected(const char* what)
|
||||||
{
|
{
|
||||||
syntax_error(String::formatted("Unexpected token {}. Expected {}", m_parser_state.m_current_token.name(), what));
|
auto message = m_parser_state.m_current_token.message();
|
||||||
|
if (message.is_empty())
|
||||||
|
message = String::formatted("Unexpected token {}. Expected {}", m_parser_state.m_current_token.name(), what);
|
||||||
|
syntax_error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parser::syntax_error(const String& message, size_t line, size_t column)
|
void Parser::syntax_error(const String& message, size_t line, size_t column)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue