diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-14 12:40:06 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-14 12:40:06 +0100 |
commit | f94099f796a26920034159cf1adbdaef400c6756 (patch) | |
tree | 31d0f71fe195868426f88e99247b1e0feefa635f /Libraries | |
parent | c0e623421972606adf41616d7be82e42d820658c (diff) | |
download | serenity-f94099f796a26920034159cf1adbdaef400c6756.zip |
LibJS: Strip double-quote characters from StringLiteral tokens
This is very hackish since I'm just doing it to make progress on
something else. :^)
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibJS/Token.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Libraries/LibJS/Token.cpp b/Libraries/LibJS/Token.cpp index ff379d37db..894b53795e 100644 --- a/Libraries/LibJS/Token.cpp +++ b/Libraries/LibJS/Token.cpp @@ -216,6 +216,9 @@ double Token::double_value() const String Token::string_value() const { + if (m_value.length() >= 2 && m_value[0] == '"' && m_value[m_value.length() - 1]) { + return m_value.substring_view(1, m_value.length() - 2); + } // FIXME: unescape the string and remove quotes return m_value; } |