mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
LibJS: Use message from invalid token in syntax error
This commit is contained in:
parent
6a3389cec6
commit
7112031bfb
Notes:
sideshowbarker
2024-07-19 01:41:29 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/7112031bfbb Pull-request: https://github.com/SerenityOS/serenity/pull/3861
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)
|
||||
{
|
||||
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)
|
||||
|
|
Loading…
Add table
Reference in a new issue