diff options
author | davidot <david.tuin@gmail.com> | 2021-09-01 18:35:33 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-09-06 08:43:38 +0100 |
commit | bbddfeef4bf5dcebd50828806d55a60224ece6b9 (patch) | |
tree | f4e5d9b33b76aaca4028fbe166cec4ba3a94a6eb /Userland/Libraries/LibJS/Token.h | |
parent | 3fee7b0d0b1985bf91e6b0b771cfb0e1eb777a04 (diff) | |
download | serenity-bbddfeef4bf5dcebd50828806d55a60224ece6b9.zip |
LibJS: Clean up token constructor and use method instead for identifiers
Having two large constructor with just one parameter difference in the
middle seems quite dangerous so just do it with a method.
Diffstat (limited to 'Userland/Libraries/LibJS/Token.h')
-rw-r--r-- | Userland/Libraries/LibJS/Token.h | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/Userland/Libraries/LibJS/Token.h b/Userland/Libraries/LibJS/Token.h index e5a9e92f8f..fe69804e29 100644 --- a/Userland/Libraries/LibJS/Token.h +++ b/Userland/Libraries/LibJS/Token.h @@ -193,19 +193,6 @@ public: { } - Token(TokenType type, String message, StringView trivia, StringView original_value, FlyString value, StringView filename, size_t line_number, size_t line_column, size_t offset) - : m_type(type) - , m_message(message) - , m_trivia(trivia) - , m_original_value(original_value) - , m_value(move(value)) - , m_filename(filename) - , m_line_number(line_number) - , m_line_column(line_column) - , m_offset(offset) - { - } - TokenType type() const { return m_type; } TokenCategory category() const; static TokenCategory category(TokenType); @@ -239,6 +226,11 @@ public: String string_value(StringValueStatus& status) const; String raw_template_value() const; + void set_identifier_value(FlyString value) + { + m_value = move(value); + } + bool is_identifier_name() const; bool trivia_contains_line_terminator() const; |