summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Token.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-14 12:40:06 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-14 12:40:06 +0100
commitf94099f796a26920034159cf1adbdaef400c6756 (patch)
tree31d0f71fe195868426f88e99247b1e0feefa635f /Libraries/LibJS/Token.cpp
parentc0e623421972606adf41616d7be82e42d820658c (diff)
downloadserenity-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/LibJS/Token.cpp')
-rw-r--r--Libraries/LibJS/Token.cpp3
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;
}