1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:57:43 +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:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -115,7 +115,7 @@ ThrowCompletionOr<ECMAScriptFunctionObject*> FunctionConstructor::create_dynamic
auto arg_count = args.size();
// 9. Let P be the empty String.
DeprecatedString parameters_string = "";
ByteString parameters_string = "";
Optional<Value> body_arg;
@ -140,29 +140,29 @@ ThrowCompletionOr<ECMAScriptFunctionObject*> FunctionConstructor::create_dynamic
size_t k = 0;
// e. Repeat, while k < argCount - 1,
Vector<DeprecatedString> parameters;
Vector<ByteString> parameters;
for (; k < arg_count - 1; ++k) {
// i. Let nextArg be args[k].
auto next_arg = args[k];
// ii. Let nextArgString be ? ToString(nextArg).
// iii. Set P to the string-concatenation of P, "," (a comma), and nextArgString.
parameters.append(TRY(next_arg.to_deprecated_string(vm)));
parameters.append(TRY(next_arg.to_byte_string(vm)));
// iv. Set k to k + 1.
}
parameters_string = DeprecatedString::join(',', parameters);
parameters_string = ByteString::join(',', parameters);
// f. Let bodyArg be args[k].
body_arg = args[k];
}
// 13. Let bodyString be the string-concatenation of 0x000A (LINE FEED), ? ToString(bodyArg), and 0x000A (LINE FEED).
auto body_string = DeprecatedString::formatted("\n{}\n", body_arg.has_value() ? TRY(body_arg->to_deprecated_string(vm)) : "");
auto body_string = ByteString::formatted("\n{}\n", body_arg.has_value() ? TRY(body_arg->to_byte_string(vm)) : "");
// 14. Let sourceString be the string-concatenation of prefix, " anonymous(", P, 0x000A (LINE FEED), ") {", bodyString, and "}".
// 15. Let sourceText be StringToCodePoints(sourceString).
auto source_text = DeprecatedString::formatted("{} anonymous({}\n) {{{}}}", prefix, parameters_string, body_string);
auto source_text = ByteString::formatted("{} anonymous({}\n) {{{}}}", prefix, parameters_string, body_string);
u8 parse_options = FunctionNodeParseOptions::CheckForFunctionAndName;
if (kind == FunctionKind::Async || kind == FunctionKind::AsyncGenerator)