mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -8,8 +8,8 @@
|
|||
|
||||
#include <AK/AllOf.h>
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/CharacterTypes.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/FloatingPointStringConversions.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/StringFloatingPointConversions.h>
|
||||
|
@ -212,11 +212,11 @@ String number_to_string(double d, NumberToStringMode mode)
|
|||
return builder.to_string().release_value();
|
||||
}
|
||||
|
||||
DeprecatedString number_to_deprecated_string(double d, NumberToStringMode mode)
|
||||
ByteString number_to_byte_string(double d, NumberToStringMode mode)
|
||||
{
|
||||
StringBuilder builder;
|
||||
number_to_string_impl(builder, d, mode);
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_byte_string();
|
||||
}
|
||||
|
||||
// 7.2.2 IsArray ( argument ), https://tc39.es/ecma262/#sec-isarray
|
||||
|
@ -439,9 +439,9 @@ ThrowCompletionOr<String> Value::to_string(VM& vm) const
|
|||
}
|
||||
|
||||
// 7.1.17 ToString ( argument ), https://tc39.es/ecma262/#sec-tostring
|
||||
ThrowCompletionOr<DeprecatedString> Value::to_deprecated_string(VM& vm) const
|
||||
ThrowCompletionOr<ByteString> Value::to_byte_string(VM& vm) const
|
||||
{
|
||||
return TRY(to_string(vm)).to_deprecated_string();
|
||||
return TRY(to_string(vm)).to_byte_string();
|
||||
}
|
||||
|
||||
ThrowCompletionOr<Utf16String> Value::to_utf16_string(VM& vm) const
|
||||
|
@ -500,7 +500,7 @@ ThrowCompletionOr<Value> Value::to_primitive_slow_case(VM& vm, PreferredType pre
|
|||
|
||||
// b. If exoticToPrim is not undefined, then
|
||||
if (exotic_to_primitive) {
|
||||
auto hint = [&]() -> DeprecatedString {
|
||||
auto hint = [&]() -> ByteString {
|
||||
switch (preferred_type) {
|
||||
// i. If preferredType is not present, let hint be "default".
|
||||
case PreferredType::Default:
|
||||
|
@ -655,7 +655,7 @@ static Optional<NumberParseResult> parse_number_text(StringView text)
|
|||
double string_to_number(StringView string)
|
||||
{
|
||||
// 1. Let text be StringToCodePoints(str).
|
||||
DeprecatedString text = Utf8View(string).trim(whitespace_characters, AK::TrimMode::Both).as_string();
|
||||
ByteString text = Utf8View(string).trim(whitespace_characters, AK::TrimMode::Both).as_string();
|
||||
|
||||
// 2. Let literal be ParseText(text, StringNumericLiteral).
|
||||
if (text.is_empty())
|
||||
|
@ -710,7 +710,7 @@ ThrowCompletionOr<Value> Value::to_number_slow_case(VM& vm) const
|
|||
return Value(as_bool() ? 1 : 0);
|
||||
// 6. If argument is a String, return StringToNumber(argument).
|
||||
case STRING_TAG:
|
||||
return string_to_number(as_string().deprecated_string());
|
||||
return string_to_number(as_string().byte_string());
|
||||
// 7. Assert: argument is an Object.
|
||||
case OBJECT_TAG: {
|
||||
// 8. Let primValue be ? ToPrimitive(argument, number).
|
||||
|
@ -764,7 +764,7 @@ ThrowCompletionOr<NonnullGCPtr<BigInt>> Value::to_bigint(VM& vm) const
|
|||
return primitive.as_bigint();
|
||||
case STRING_TAG: {
|
||||
// 1. Let n be ! StringToBigInt(prim).
|
||||
auto bigint = string_to_bigint(vm, primitive.as_string().deprecated_string());
|
||||
auto bigint = string_to_bigint(vm, primitive.as_string().byte_string());
|
||||
|
||||
// 2. If n is undefined, throw a SyntaxError exception.
|
||||
if (!bigint.has_value())
|
||||
|
@ -894,7 +894,7 @@ ThrowCompletionOr<PropertyKey> Value::to_property_key(VM& vm) const
|
|||
}
|
||||
|
||||
// 3. Return ! ToString(key).
|
||||
return MUST(key.to_deprecated_string(vm));
|
||||
return MUST(key.to_byte_string(vm));
|
||||
}
|
||||
|
||||
// 7.1.6 ToInt32 ( argument ), https://tc39.es/ecma262/#sec-toint32
|
||||
|
@ -2212,7 +2212,7 @@ bool same_value_non_number(Value lhs, Value rhs)
|
|||
// 5. If x is a String, then
|
||||
if (lhs.is_string()) {
|
||||
// a. If x and y are exactly the same sequence of code units (same length and same code units at corresponding indices), return true; otherwise, return false.
|
||||
return lhs.as_string().deprecated_string() == rhs.as_string().deprecated_string();
|
||||
return lhs.as_string().byte_string() == rhs.as_string().byte_string();
|
||||
}
|
||||
|
||||
// 3. If x is undefined, return true.
|
||||
|
@ -2293,7 +2293,7 @@ ThrowCompletionOr<bool> is_loosely_equal(VM& vm, Value lhs, Value rhs)
|
|||
// 7. If Type(x) is BigInt and Type(y) is String, then
|
||||
if (lhs.is_bigint() && rhs.is_string()) {
|
||||
// a. Let n be StringToBigInt(y).
|
||||
auto bigint = string_to_bigint(vm, rhs.as_string().deprecated_string());
|
||||
auto bigint = string_to_bigint(vm, rhs.as_string().byte_string());
|
||||
|
||||
// b. If n is undefined, return false.
|
||||
if (!bigint.has_value())
|
||||
|
@ -2374,8 +2374,8 @@ ThrowCompletionOr<TriState> is_less_than(VM& vm, Value lhs, Value rhs, bool left
|
|||
|
||||
// 3. If px is a String and py is a String, then
|
||||
if (x_primitive.is_string() && y_primitive.is_string()) {
|
||||
auto x_string = x_primitive.as_string().deprecated_string();
|
||||
auto y_string = y_primitive.as_string().deprecated_string();
|
||||
auto x_string = x_primitive.as_string().byte_string();
|
||||
auto y_string = y_primitive.as_string().byte_string();
|
||||
|
||||
Utf8View x_code_points { x_string };
|
||||
Utf8View y_code_points { y_string };
|
||||
|
@ -2410,7 +2410,7 @@ ThrowCompletionOr<TriState> is_less_than(VM& vm, Value lhs, Value rhs, bool left
|
|||
// a. If px is a BigInt and py is a String, then
|
||||
if (x_primitive.is_bigint() && y_primitive.is_string()) {
|
||||
// i. Let ny be StringToBigInt(py).
|
||||
auto y_bigint = string_to_bigint(vm, y_primitive.as_string().deprecated_string());
|
||||
auto y_bigint = string_to_bigint(vm, y_primitive.as_string().byte_string());
|
||||
|
||||
// ii. If ny is undefined, return undefined.
|
||||
if (!y_bigint.has_value())
|
||||
|
@ -2425,7 +2425,7 @@ ThrowCompletionOr<TriState> is_less_than(VM& vm, Value lhs, Value rhs, bool left
|
|||
// b. If px is a String and py is a BigInt, then
|
||||
if (x_primitive.is_string() && y_primitive.is_bigint()) {
|
||||
// i. Let nx be StringToBigInt(px).
|
||||
auto x_bigint = string_to_bigint(vm, x_primitive.as_string().deprecated_string());
|
||||
auto x_bigint = string_to_bigint(vm, x_primitive.as_string().byte_string());
|
||||
|
||||
// ii. If nx is undefined, return undefined.
|
||||
if (!x_bigint.has_value())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue