mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibJS: Report correct line/column for string literal syntax errors
We're passing a token to this function, so m_current_token is actually the next token - which leads to incorrect line/column numbers for string literal syntax errors: "\u" ^ Uncaught exception: [SyntaxError]: Malformed unicode escape sequence (line: 1, column: 5) Rather than: "\u" ^ Uncaught exception: [SyntaxError]: Malformed unicode escape sequence (line: 1, column: 1)
This commit is contained in:
parent
d6f8c52245
commit
9f036959e8
Notes:
sideshowbarker
2024-07-19 01:46:34 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/9f036959e86 Pull-request: https://github.com/SerenityOS/serenity/pull/3834
1 changed files with 2 additions and 4 deletions
|
@ -849,10 +849,8 @@ NonnullRefPtr<StringLiteral> Parser::parse_string_literal(Token token)
|
|||
message = "Unicode code_point must not be greater than 0x10ffff in escape sequence";
|
||||
}
|
||||
|
||||
syntax_error(
|
||||
message,
|
||||
m_parser_state.m_current_token.line_number(),
|
||||
m_parser_state.m_current_token.line_column());
|
||||
if (!message.is_empty())
|
||||
syntax_error(message, token.line_number(), token.line_column());
|
||||
}
|
||||
|
||||
if (m_parser_state.m_use_strict_directive == UseStrictDirectiveState::Looking) {
|
||||
|
|
Loading…
Reference in a new issue