diff options
author | Linus Groh <mail@linusgroh.de> | 2022-12-06 22:17:27 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-12-07 16:43:06 +0000 |
commit | 525f22d018cb5f9c4c6ea0e2b5544fdcab8da483 (patch) | |
tree | 2488bac4fab4acec0d258c9bac2338bc95ee6398 /Userland/Libraries/LibJS/Runtime/StringObject.cpp | |
parent | 5db38d7ba1a8caa5138dd65cc06be0c0e5a568e4 (diff) | |
download | serenity-525f22d018cb5f9c4c6ea0e2b5544fdcab8da483.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/StringObject.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/StringObject.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/StringObject.cpp b/Userland/Libraries/LibJS/Runtime/StringObject.cpp index eb186653e6..2ebd852bd8 100644 --- a/Userland/Libraries/LibJS/Runtime/StringObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringObject.cpp @@ -71,7 +71,7 @@ static Optional<PropertyDescriptor> string_get_own_property(StringObject const& return {}; // 10. Let resultStr be the String value of length 1, containing one code unit from str, specifically the code unit at index ℝ(index). - auto result_str = js_string(string.vm(), str.substring_view(index.as_index(), 1)); + auto result_str = PrimitiveString::create(string.vm(), str.substring_view(index.as_index(), 1)); // 11. Return the PropertyDescriptor { [[Value]]: resultStr, [[Writable]]: false, [[Enumerable]]: true, [[Configurable]]: false }. return PropertyDescriptor { @@ -138,14 +138,14 @@ ThrowCompletionOr<MarkedVector<Value>> StringObject::internal_own_property_keys( // 5. For each integer i starting with 0 such that i < len, in ascending order, do for (size_t i = 0; i < length; ++i) { // a. Add ! ToString(𝔽(i)) as the last element of keys. - keys.append(js_string(vm, DeprecatedString::number(i))); + keys.append(PrimitiveString::create(vm, DeprecatedString::number(i))); } // 6. For each own property key P of O such that P is an array index and ! ToIntegerOrInfinity(P) ≥ len, in ascending numeric index order, do for (auto& entry : indexed_properties()) { if (entry.index() >= length) { // a. Add P as the last element of keys. - keys.append(js_string(vm, DeprecatedString::number(entry.index()))); + keys.append(PrimitiveString::create(vm, DeprecatedString::number(entry.index()))); } } |