mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
LibJS: Convert short string literal PrimitiveString instances to String
This commit is contained in:
parent
49e8dcf0b2
commit
69a56a8e39
Notes:
sideshowbarker
2024-07-17 08:34:29 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/69a56a8e39 Pull-request: https://github.com/SerenityOS/serenity/pull/17388 Reviewed-by: https://github.com/linusg
2 changed files with 3 additions and 3 deletions
|
@ -450,9 +450,9 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_string)
|
|||
if (number_value.is_negative_infinity())
|
||||
return PrimitiveString::create(vm, "-Infinity");
|
||||
if (number_value.is_nan())
|
||||
return PrimitiveString::create(vm, "NaN");
|
||||
return PrimitiveString::create(vm, String::from_utf8_short_string("NaN"sv));
|
||||
if (number_value.is_positive_zero() || number_value.is_negative_zero())
|
||||
return PrimitiveString::create(vm, "0");
|
||||
return PrimitiveString::create(vm, String::from_utf8_short_string("0"sv));
|
||||
|
||||
double number = number_value.as_double();
|
||||
bool negative = number < 0;
|
||||
|
|
|
@ -494,7 +494,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::match_all)
|
|||
|
||||
auto string = TRY(this_object.to_utf16_string(vm));
|
||||
|
||||
auto rx = TRY(regexp_create(vm, regexp, PrimitiveString::create(vm, "g")));
|
||||
auto rx = TRY(regexp_create(vm, regexp, PrimitiveString::create(vm, String::from_utf8_short_string("g"sv))));
|
||||
return TRY(Value(rx).invoke(vm, *vm.well_known_symbol_match_all(), PrimitiveString::create(vm, move(string))));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue