diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-18 18:34:51 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-18 19:54:24 +0200 |
commit | 8bde4e94d874e2b741ed65a5447e132915eead34 (patch) | |
tree | d81dc922ce2134a09ea5d702d3a947ecf2fabf4e | |
parent | bf46845819a1575a41531789bfa11dbaef25e706 (diff) | |
download | serenity-8bde4e94d874e2b741ed65a5447e132915eead34.zip |
LibJS: Make Lexer::s_keywords store keywords as FlyString
This allows O(1) comparison against lexed keywords, since we lex to
FlyString.
-rw-r--r-- | Userland/Libraries/LibJS/Lexer.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Lexer.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/Lexer.cpp b/Userland/Libraries/LibJS/Lexer.cpp index 7b58a84f32..f9c0d31de7 100644 --- a/Userland/Libraries/LibJS/Lexer.cpp +++ b/Userland/Libraries/LibJS/Lexer.cpp @@ -16,7 +16,7 @@ namespace JS { -HashMap<String, TokenType> Lexer::s_keywords; +HashMap<FlyString, TokenType> Lexer::s_keywords; HashMap<String, TokenType> Lexer::s_three_char_tokens; HashMap<String, TokenType> Lexer::s_two_char_tokens; HashMap<char, TokenType> Lexer::s_single_char_tokens; diff --git a/Userland/Libraries/LibJS/Lexer.h b/Userland/Libraries/LibJS/Lexer.h index 1ecbac223b..ee151a5753 100644 --- a/Userland/Libraries/LibJS/Lexer.h +++ b/Userland/Libraries/LibJS/Lexer.h @@ -77,7 +77,7 @@ private: bool m_allow_html_comments { true }; - static HashMap<String, TokenType> s_keywords; + static HashMap<FlyString, TokenType> s_keywords; static HashMap<String, TokenType> s_three_char_tokens; static HashMap<String, TokenType> s_two_char_tokens; static HashMap<char, TokenType> s_single_char_tokens; |