1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:37:34 +00:00

LibJS: Replace standalone js_string() with PrimitiveString::create()

Note that js_rope_string() has been folded into this, the old name was
misleading - it would not always create a rope string, only if both
sides are not empty strings. Use a three-argument create() overload
instead.
This commit is contained in:
Linus Groh 2022-12-06 22:17:27 +00:00
parent 5db38d7ba1
commit 525f22d018
144 changed files with 656 additions and 672 deletions

View file

@ -186,10 +186,10 @@ ThrowCompletionOr<double> compare_array_elements(VM& vm, Value x, Value y, Funct
}
// 5. Let xString be ? ToString(x).
auto* x_string = js_string(vm, TRY(x.to_string(vm)));
auto x_string = PrimitiveString::create(vm, TRY(x.to_string(vm)));
// 6. Let yString be ? ToString(y).
auto* y_string = js_string(vm, TRY(y.to_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));
@ -330,7 +330,7 @@ ThrowCompletionOr<MarkedVector<Value>> Array::internal_own_property_keys() const
auto& vm = this->vm();
auto keys = TRY(Object::internal_own_property_keys());
// FIXME: This is pretty expensive, find a better way to do this
keys.insert(indexed_properties().real_size(), js_string(vm, vm.names.length.as_string()));
keys.insert(indexed_properties().real_size(), PrimitiveString::create(vm, vm.names.length.as_string()));
return { move(keys) };
}