mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-27 02:47:31 +09:00
Compare commits
3 commits
741ba79bfe
...
414ce93828
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
414ce93828 | ||
|
|
cac6802c55 | ||
|
|
ac5a46c3bc |
3 changed files with 70 additions and 0 deletions
|
|
@ -903,6 +903,73 @@ function SetFromNonTypedArray(target, array, targetOffset, targetLength, targetB
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ES2023 23.2.3.33 %TypedArray%.prototype.toSorted ( comparator )
|
||||||
|
function TypedArrayToSorted(comparator) {
|
||||||
|
// Step 1.
|
||||||
|
if (comparator !== undefined && !IsCallable(comparator))
|
||||||
|
ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(0, comparator));
|
||||||
|
|
||||||
|
// Step 2.
|
||||||
|
var O = this;
|
||||||
|
|
||||||
|
// Step 3.
|
||||||
|
// This function is not generic.
|
||||||
|
// We want to make sure that we have an attached buffer, per spec prose.
|
||||||
|
var isTypedArray = IsTypedArrayEnsuringArrayBuffer(O);
|
||||||
|
|
||||||
|
// If we got here, `this` is either a typed array or a wrapper for one.
|
||||||
|
|
||||||
|
// Step 4.
|
||||||
|
var len;
|
||||||
|
if (isTypedArray)
|
||||||
|
len = TypedArrayLength(O);
|
||||||
|
else
|
||||||
|
len = callFunction(CallTypedArrayMethodIfWrapped, O, "TypedArrayLengthMethod");
|
||||||
|
|
||||||
|
// Step 5.
|
||||||
|
var A = TypedArrayCreateSameType(O, len);
|
||||||
|
|
||||||
|
// Step 8.
|
||||||
|
var sortedList = new List();
|
||||||
|
for (var k = 0; k < len; k++) {
|
||||||
|
sortedList[k] = O[k];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len > 1) {
|
||||||
|
// Steps 6-7.
|
||||||
|
var sortCompare;
|
||||||
|
if (comparator === undefined) {
|
||||||
|
var isBigIntContentType;
|
||||||
|
if (isTypedArray) {
|
||||||
|
isBigIntContentType = callFunction(TypedArrayContentTypeIsBigIntMethod, O);
|
||||||
|
} else {
|
||||||
|
isBigIntContentType = callFunction(CallTypedArrayMethodIfWrapped, O,
|
||||||
|
"TypedArrayContentTypeIsBigIntMethod");
|
||||||
|
}
|
||||||
|
sortCompare = isBigIntContentType ? TypedArrayCompareBigInt : TypedArrayCompare;
|
||||||
|
} else {
|
||||||
|
var wrappedComparator = comparator;
|
||||||
|
sortCompare = function(x, y) {
|
||||||
|
// CompareTypedArrayElements step 2.a.
|
||||||
|
var v = ToNumber(callContentFunction(wrappedComparator, undefined, x, y));
|
||||||
|
|
||||||
|
// CompareTypedArrayElements step 2.b.
|
||||||
|
return Number_isNaN(v) ? 0 : v;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
MergeSort(sortedList, len, sortCompare);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Steps 9-10.
|
||||||
|
for (var j = 0; j < len; j++) {
|
||||||
|
A[j] = sortedList[j];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 11.
|
||||||
|
return A;
|
||||||
|
}
|
||||||
|
|
||||||
// ES6 draft 20150220 22.2.3.22.2 %TypedArray%.prototype.set(typedArray [, offset])
|
// ES6 draft 20150220 22.2.3.22.2 %TypedArray%.prototype.set(typedArray [, offset])
|
||||||
function SetFromTypedArray(target, typedArray, targetOffset, targetLength) {
|
function SetFromTypedArray(target, typedArray, targetOffset, targetLength) {
|
||||||
assert(IsPossiblyWrappedTypedArray(typedArray),
|
assert(IsPossiblyWrappedTypedArray(typedArray),
|
||||||
|
|
|
||||||
|
|
@ -1643,6 +1643,9 @@ TypedArrayObject::protoFunctions[] = {
|
||||||
|
|
||||||
/* ES2022 additions */
|
/* ES2022 additions */
|
||||||
JS_SELF_HOSTED_FN("at", "TypedArrayAt", 1, 0),
|
JS_SELF_HOSTED_FN("at", "TypedArrayAt", 1, 0),
|
||||||
|
|
||||||
|
/* ES2023 (WIP) */
|
||||||
|
JS_SELF_HOSTED_FN("toSorted", "TypedArrayToSorted", 1, 0),
|
||||||
|
|
||||||
JS_FS_END
|
JS_FS_END
|
||||||
};
|
};
|
||||||
|
|
|
||||||
BIN
other-licenses/7zstub/dactyloidae/7zSD.sfx
Normal file
BIN
other-licenses/7zstub/dactyloidae/7zSD.sfx
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue