LibJS: Fix crash in Lexer on EOF in unterminated template literal

Fixes #4252.
This commit is contained in:
Linus Groh 2020-11-29 22:59:06 +00:00 committed by Andreas Kling
commit ea08bf5812
Notes: sideshowbarker 2024-07-19 01:10:06 +09:00

View file

@ -451,8 +451,10 @@ Token Lexer::next()
consume(); consume();
consume(); consume();
} }
if (is_eof() && !m_template_states.is_empty())
token_type = TokenType::TemplateLiteralString; token_type = TokenType::UnterminatedTemplateLiteral;
else
token_type = TokenType::TemplateLiteralString;
} }
} else if (is_identifier_start()) { } else if (is_identifier_start()) {
// identifier or keyword // identifier or keyword