Implement TypedArray.prototype.toSorted (#199)
This commit is contained in:
parent
05f00a87f7
commit
83dfc635f1
2 changed files with 19 additions and 14 deletions
19
quickjs.c
19
quickjs.c
|
@ -49562,6 +49562,24 @@ static JSValue js_typed_array_sort(JSContext *ctx, JSValue this_val,
|
||||||
return js_dup(this_val);
|
return js_dup(this_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static JSValue js_typed_array_toSorted(JSContext *ctx, JSValue this_val,
|
||||||
|
int argc, JSValue *argv)
|
||||||
|
{
|
||||||
|
JSValue arr, ret;
|
||||||
|
JSObject *p;
|
||||||
|
|
||||||
|
p = get_typed_array(ctx, this_val, /*is_dataview*/0);
|
||||||
|
if (!p)
|
||||||
|
return JS_EXCEPTION;
|
||||||
|
arr = js_typed_array_constructor_ta(ctx, JS_UNDEFINED, this_val,
|
||||||
|
p->class_id);
|
||||||
|
if (JS_IsException(arr))
|
||||||
|
return JS_EXCEPTION;
|
||||||
|
ret = js_typed_array_sort(ctx, arr, argc, argv);
|
||||||
|
JS_FreeValue(ctx, arr);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static const JSCFunctionListEntry js_typed_array_base_funcs[] = {
|
static const JSCFunctionListEntry js_typed_array_base_funcs[] = {
|
||||||
JS_CFUNC_DEF("from", 1, js_typed_array_from ),
|
JS_CFUNC_DEF("from", 1, js_typed_array_from ),
|
||||||
JS_CFUNC_DEF("of", 0, js_typed_array_of ),
|
JS_CFUNC_DEF("of", 0, js_typed_array_of ),
|
||||||
|
@ -49598,6 +49616,7 @@ static const JSCFunctionListEntry js_typed_array_base_proto_funcs[] = {
|
||||||
JS_CFUNC_DEF("slice", 2, js_typed_array_slice ),
|
JS_CFUNC_DEF("slice", 2, js_typed_array_slice ),
|
||||||
JS_CFUNC_DEF("subarray", 2, js_typed_array_subarray ),
|
JS_CFUNC_DEF("subarray", 2, js_typed_array_subarray ),
|
||||||
JS_CFUNC_DEF("sort", 1, js_typed_array_sort ),
|
JS_CFUNC_DEF("sort", 1, js_typed_array_sort ),
|
||||||
|
JS_CFUNC_DEF("toSorted", 1, js_typed_array_toSorted ),
|
||||||
JS_CFUNC_MAGIC_DEF("join", 1, js_typed_array_join, 0 ),
|
JS_CFUNC_MAGIC_DEF("join", 1, js_typed_array_join, 0 ),
|
||||||
JS_CFUNC_MAGIC_DEF("toLocaleString", 0, js_typed_array_join, 1 ),
|
JS_CFUNC_MAGIC_DEF("toLocaleString", 0, js_typed_array_join, 1 ),
|
||||||
JS_CFUNC_MAGIC_DEF("indexOf", 1, js_typed_array_indexOf, special_indexOf ),
|
JS_CFUNC_MAGIC_DEF("indexOf", 1, js_typed_array_indexOf, special_indexOf ),
|
||||||
|
|
|
@ -7,20 +7,6 @@ test262/test/built-ins/TypedArray/prototype/set/array-arg-targetbuffer-detached-
|
||||||
test262/test/built-ins/TypedArray/prototype/set/array-arg-targetbuffer-detached-on-get-src-value-no-throw.js:30: strict mode: TypeError: out-of-bound numeric index (Testing with Float64Array.)
|
test262/test/built-ins/TypedArray/prototype/set/array-arg-targetbuffer-detached-on-get-src-value-no-throw.js:30: strict mode: TypeError: out-of-bound numeric index (Testing with Float64Array.)
|
||||||
test262/test/built-ins/TypedArray/prototype/sort/sort-tonumber.js:30: TypeError: ArrayBuffer is detached (Testing with Float64Array.)
|
test262/test/built-ins/TypedArray/prototype/sort/sort-tonumber.js:30: TypeError: ArrayBuffer is detached (Testing with Float64Array.)
|
||||||
test262/test/built-ins/TypedArray/prototype/sort/sort-tonumber.js:30: strict mode: TypeError: ArrayBuffer is detached (Testing with Float64Array.)
|
test262/test/built-ins/TypedArray/prototype/sort/sort-tonumber.js:30: strict mode: TypeError: ArrayBuffer is detached (Testing with Float64Array.)
|
||||||
test262/test/built-ins/TypedArray/prototype/toSorted/ignores-species.js:26: TypeError: not a function (Testing with Float64Array.)
|
|
||||||
test262/test/built-ins/TypedArray/prototype/toSorted/ignores-species.js:26: strict mode: TypeError: not a function (Testing with Float64Array.)
|
|
||||||
test262/test/built-ins/TypedArray/prototype/toSorted/immutable.js:14: TypeError: not a function (Testing with Float64Array.)
|
|
||||||
test262/test/built-ins/TypedArray/prototype/toSorted/immutable.js:14: strict mode: TypeError: not a function (Testing with Float64Array.)
|
|
||||||
test262/test/built-ins/TypedArray/prototype/toSorted/length-property-ignored.js:21: TypeError: not a function (Testing with Float64Array.)
|
|
||||||
test262/test/built-ins/TypedArray/prototype/toSorted/length-property-ignored.js:21: strict mode: TypeError: not a function (Testing with Float64Array.)
|
|
||||||
test262/test/built-ins/TypedArray/prototype/toSorted/metadata/length.js:30: TypeError: cannot convert to object
|
|
||||||
test262/test/built-ins/TypedArray/prototype/toSorted/metadata/length.js:30: strict mode: TypeError: cannot convert to object
|
|
||||||
test262/test/built-ins/TypedArray/prototype/toSorted/metadata/name.js:28: TypeError: cannot convert to object
|
|
||||||
test262/test/built-ins/TypedArray/prototype/toSorted/metadata/name.js:28: strict mode: TypeError: cannot convert to object
|
|
||||||
test262/test/built-ins/TypedArray/prototype/toSorted/metadata/property-descriptor.js:18: Test262Error: typeof Expected SameValue(«undefined», «function») to be true
|
|
||||||
test262/test/built-ins/TypedArray/prototype/toSorted/metadata/property-descriptor.js:18: strict mode: Test262Error: typeof Expected SameValue(«undefined», «function») to be true
|
|
||||||
test262/test/built-ins/TypedArray/prototype/toSorted/not-a-constructor.js:25: Test262Error: isConstructor invoked with a non-function value
|
|
||||||
test262/test/built-ins/TypedArray/prototype/toSorted/not-a-constructor.js:25: strict mode: Test262Error: isConstructor invoked with a non-function value
|
|
||||||
test262/test/built-ins/TypedArray/prototype/with/BigInt/early-type-coercion-bigint.js:29: TypeError: not a function (Testing with BigInt64Array.)
|
test262/test/built-ins/TypedArray/prototype/with/BigInt/early-type-coercion-bigint.js:29: TypeError: not a function (Testing with BigInt64Array.)
|
||||||
test262/test/built-ins/TypedArray/prototype/with/BigInt/early-type-coercion-bigint.js:29: strict mode: TypeError: not a function (Testing with BigInt64Array.)
|
test262/test/built-ins/TypedArray/prototype/with/BigInt/early-type-coercion-bigint.js:29: strict mode: TypeError: not a function (Testing with BigInt64Array.)
|
||||||
test262/test/built-ins/TypedArray/prototype/with/early-type-coercion.js:29: TypeError: not a function (Testing with Float64Array.)
|
test262/test/built-ins/TypedArray/prototype/with/early-type-coercion.js:29: TypeError: not a function (Testing with Float64Array.)
|
||||||
|
|
Loading…
Reference in a new issue