mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +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:
committed by
Ali Mohammad Pur
parent
38d62563b3
commit
5e1499d104
@@ -26,7 +26,7 @@ namespace JS {
|
||||
JS_DEFINE_ALLOCATOR(DateConstructor);
|
||||
|
||||
// 21.4.3.2 Date.parse ( string ), https://tc39.es/ecma262/#sec-date.parse
|
||||
static double parse_simplified_iso8601(DeprecatedString const& iso_8601)
|
||||
static double parse_simplified_iso8601(ByteString const& iso_8601)
|
||||
{
|
||||
// 21.4.1.15 Date Time String Format, https://tc39.es/ecma262/#sec-date-time-string-format
|
||||
GenericLexer lexer(iso_8601);
|
||||
@@ -150,7 +150,7 @@ static double parse_simplified_iso8601(DeprecatedString const& iso_8601)
|
||||
return time_clip(time_ms);
|
||||
}
|
||||
|
||||
static double parse_date_string(DeprecatedString const& date_string)
|
||||
static double parse_date_string(ByteString const& date_string)
|
||||
{
|
||||
auto value = parse_simplified_iso8601(date_string);
|
||||
if (isfinite(value))
|
||||
@@ -246,7 +246,7 @@ ThrowCompletionOr<NonnullGCPtr<Object>> DateConstructor::construct(FunctionObjec
|
||||
if (primitive.is_string()) {
|
||||
// 1. Assert: The next step never returns an abrupt completion because Type(v) is String.
|
||||
// 2. Let tv be the result of parsing v as a date, in exactly the same manner as for the parse method (21.4.3.2).
|
||||
time_value = parse_date_string(primitive.as_string().deprecated_string());
|
||||
time_value = parse_date_string(primitive.as_string().byte_string());
|
||||
}
|
||||
// iii. Else,
|
||||
else {
|
||||
@@ -321,7 +321,7 @@ JS_DEFINE_NATIVE_FUNCTION(DateConstructor::parse)
|
||||
if (!vm.argument_count())
|
||||
return js_nan();
|
||||
|
||||
auto date_string = TRY(vm.argument(0).to_deprecated_string(vm));
|
||||
auto date_string = TRY(vm.argument(0).to_byte_string(vm));
|
||||
|
||||
return Value(parse_date_string(date_string));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user