LibJS: Don't store current token in both Lexer and Parser

Just give Parser a way to access the one stored in Lexer.
This commit is contained in:
Andreas Kling 2025-11-08 20:25:53 +01:00 committed by Andreas Kling
parent d3e8fbd9cd
commit 841fe0b51c
Notes: github-actions[bot] 2025-11-09 11:15:45 +00:00
4 changed files with 100 additions and 98 deletions

View file

@ -636,7 +636,7 @@ bool Lexer::slash_means_division() const
|| type == TokenType::TemplateLiteralEnd;
}
Token Lexer::next()
Token const& Lexer::next()
{
auto trivia_start = m_position;
auto in_template = !m_template_states.is_empty();
@ -970,7 +970,7 @@ Token Lexer::next()
return m_current_token;
}
Token Lexer::force_slash_as_regex()
Token const& Lexer::force_slash_as_regex()
{
VERIFY(m_current_token.type() == TokenType::Slash || m_current_token.type() == TokenType::SlashEquals);