mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-21 01:31:55 +00:00
LibJS: Prefer Value::to_string() over to_byte_string() in more places
We should always prefer working with String, and Value::to_string() may even return a cached String if the Value refers to a primitive string, but no caching occurs for ByteString.
This commit is contained in:
parent
8155377b5f
commit
e83a2c2369
Notes:
github-actions[bot]
2025-03-24 22:28:59 +00:00
Author: https://github.com/awesomekling
Commit: e83a2c2369
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4067
Reviewed-by: https://github.com/trflynn89
6 changed files with 15 additions and 17 deletions
|
@ -243,10 +243,10 @@ ThrowCompletionOr<double> compare_array_elements(VM& vm, Value x, Value y, Funct
|
|||
}
|
||||
|
||||
// 5. Let xString be ? ToString(x).
|
||||
auto x_string = PrimitiveString::create(vm, TRY(x.to_byte_string(vm)));
|
||||
auto x_string = PrimitiveString::create(vm, TRY(x.to_string(vm)));
|
||||
|
||||
// 6. Let yString be ? ToString(y).
|
||||
auto y_string = PrimitiveString::create(vm, TRY(y.to_byte_string(vm)));
|
||||
auto y_string = PrimitiveString::create(vm, TRY(y.to_string(vm)));
|
||||
|
||||
// 7. Let xSmaller be ! IsLessThan(xString, yString, true).
|
||||
auto x_smaller = MUST(is_less_than(vm, x_string, y_string, true));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue