summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Token.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-12-04 18:02:33 +0000
committerAndreas Kling <kling@serenityos.org>2022-12-06 08:54:33 +0100
commit6e19ab2bbce0b113b628e6f8e9b5c0640053933e (patch)
tree372d21b2f5dcff112f5d0089559c6af5798680d4 /Userland/Libraries/LibJS/Token.cpp
parentf74251606d74b504a1379ebb893fdb5529054ea5 (diff)
downloadserenity-6e19ab2bbce0b113b628e6f8e9b5c0640053933e.zip
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
Diffstat (limited to 'Userland/Libraries/LibJS/Token.cpp')
-rw-r--r--Userland/Libraries/LibJS/Token.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibJS/Token.cpp b/Userland/Libraries/LibJS/Token.cpp
index 4e5e8daf1f..d5adeaa6bb 100644
--- a/Userland/Libraries/LibJS/Token.cpp
+++ b/Userland/Libraries/LibJS/Token.cpp
@@ -63,7 +63,7 @@ double Token::double_value() const
builder.append(ch);
}
- String value_string = builder.to_string();
+ DeprecatedString value_string = builder.to_string();
if (value_string[0] == '0' && value_string.length() >= 2) {
if (value_string[1] == 'x' || value_string[1] == 'X') {
// hexadecimal
@@ -92,14 +92,14 @@ static u32 hex2int(char x)
return 10u + (to_ascii_lowercase(x) - 'a');
}
-String Token::string_value(StringValueStatus& status) const
+DeprecatedString Token::string_value(StringValueStatus& status) const
{
VERIFY(type() == TokenType::StringLiteral || type() == TokenType::TemplateLiteralString);
auto is_template = type() == TokenType::TemplateLiteralString;
GenericLexer lexer(is_template ? value() : value().substring_view(1, value().length() - 2));
- auto encoding_failure = [&status](StringValueStatus parse_status) -> String {
+ auto encoding_failure = [&status](StringValueStatus parse_status) -> DeprecatedString {
status = parse_status;
return {};
};
@@ -173,7 +173,7 @@ String Token::string_value(StringValueStatus& status) const
// In non-strict mode LegacyOctalEscapeSequence is allowed in strings:
// https://tc39.es/ecma262/#sec-additional-syntax-string-literals
- String octal_str;
+ DeprecatedString octal_str;
auto is_octal_digit = [](char ch) { return ch >= '0' && ch <= '7'; };
auto is_zero_to_three = [](char ch) { return ch >= '0' && ch <= '3'; };
@@ -213,7 +213,7 @@ String Token::string_value(StringValueStatus& status) const
}
// 12.8.6.2 Static Semantics: TRV, https://tc39.es/ecma262/#sec-static-semantics-trv
-String Token::raw_template_value() const
+DeprecatedString Token::raw_template_value() const
{
return value().replace("\r\n"sv, "\n"sv, ReplaceMode::All).replace("\r"sv, "\n"sv, ReplaceMode::All);
}