mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 15:10:19 +00:00
LibJS: Remove Array::create_from overload that accepts a plain vector
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
There's no need to have overloads for both a span and a vector.
This commit is contained in:
parent
663a5e97ca
commit
ddf3add6a7
Notes:
github-actions[bot]
2024-10-31 23:36:46 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/ddf3add6a7f Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2088
2 changed files with 2 additions and 21 deletions
|
@ -45,25 +45,7 @@ ThrowCompletionOr<NonnullGCPtr<Array>> Array::create(Realm& realm, u64 length, O
|
|||
}
|
||||
|
||||
// 7.3.18 CreateArrayFromList ( elements ), https://tc39.es/ecma262/#sec-createarrayfromlist
|
||||
NonnullGCPtr<Array> Array::create_from(Realm& realm, Vector<Value> const& elements)
|
||||
{
|
||||
// 1. Let array be ! ArrayCreate(0).
|
||||
auto array = MUST(Array::create(realm, 0));
|
||||
|
||||
// 2. Let n be 0.
|
||||
// 3. For each element e of elements, do
|
||||
for (u32 n = 0; n < elements.size(); ++n) {
|
||||
// a. Perform ! CreateDataPropertyOrThrow(array, ! ToString(𝔽(n)), e).
|
||||
MUST(array->create_data_property_or_throw(n, elements[n]));
|
||||
|
||||
// b. Set n to n + 1.
|
||||
}
|
||||
|
||||
// 4. Return array.
|
||||
return array;
|
||||
}
|
||||
|
||||
NonnullGCPtr<Array> Array::create_from(Realm& realm, ReadonlySpan<Value> const& elements)
|
||||
NonnullGCPtr<Array> Array::create_from(Realm& realm, ReadonlySpan<Value> elements)
|
||||
{
|
||||
// 1. Let array be ! ArrayCreate(0).
|
||||
auto array = MUST(Array::create(realm, 0));
|
||||
|
|
|
@ -25,8 +25,7 @@ class Array : public Object {
|
|||
|
||||
public:
|
||||
static ThrowCompletionOr<NonnullGCPtr<Array>> create(Realm&, u64 length, Object* prototype = nullptr);
|
||||
static NonnullGCPtr<Array> create_from(Realm&, Vector<Value> const&);
|
||||
static NonnullGCPtr<Array> create_from(Realm&, ReadonlySpan<Value> const&);
|
||||
static NonnullGCPtr<Array> create_from(Realm&, ReadonlySpan<Value>);
|
||||
|
||||
template<size_t N>
|
||||
static NonnullGCPtr<Array> create_from(Realm& realm, Value const (&values)[N])
|
||||
|
|
Loading…
Reference in a new issue