mirror of
https://github.com/tc39/test262.git
synced 2025-07-13 00:54:39 +02:00
Make resizableArrayBufferUtils not depend on syntax that may not be
supported
This commit is contained in:
parent
b6c2f55954
commit
79df6ec2e1
@ -18,14 +18,10 @@ defines:
|
|||||||
features: [BigInt]
|
features: [BigInt]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
class MyUint8Array extends Uint8Array {
|
// Using new Function()(); instead of just 'class x extends Y' as to not bomb out when `class` isn't supported
|
||||||
}
|
const MyUint8Array = new Function('return class MyUint8Array extends Uint8Array {}')();
|
||||||
|
const MyFloat32Array = new Function('return class MyFloat32Array extends Float32Array {}')();
|
||||||
class MyFloat32Array extends Float32Array {
|
const MyBigInt64Array = new Function('return class MyBigInt64Array extends BigInt64Array {}')();
|
||||||
}
|
|
||||||
|
|
||||||
class MyBigInt64Array extends BigInt64Array {
|
|
||||||
}
|
|
||||||
|
|
||||||
const builtinCtors = [
|
const builtinCtors = [
|
||||||
Uint8Array,
|
Uint8Array,
|
||||||
@ -39,14 +35,17 @@ const builtinCtors = [
|
|||||||
Uint8ClampedArray,
|
Uint8ClampedArray,
|
||||||
];
|
];
|
||||||
|
|
||||||
// BigInt and Float16Array are newer features adding them above unconditionally
|
// Big(U)int64Array and Float16Array are newer features adding them above unconditionally
|
||||||
// would cause implementations lacking it to fail every test which uses it.
|
// would cause implementations lacking it to fail every test which uses it.
|
||||||
if (typeof Float16Array !== 'undefined') {
|
if (typeof Float16Array !== 'undefined') {
|
||||||
builtinCtors.push(Float16Array);
|
builtinCtors.push(Float16Array);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof BigInt !== 'undefined') {
|
if (typeof BigUint64Array !== 'undefined') {
|
||||||
builtinCtors.push(BigUint64Array);
|
builtinCtors.push(BigUint64Array);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof BigInt64Array !== 'undefined') {
|
||||||
builtinCtors.push(BigInt64Array);
|
builtinCtors.push(BigInt64Array);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,13 +59,9 @@ if (typeof Float16Array !== 'undefined') {
|
|||||||
floatCtors.push(Float16Array);
|
floatCtors.push(Float16Array);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ctors = [
|
const ctors = builtinCtors.concat(MyUint8Array, MyFloat32Array);
|
||||||
...builtinCtors,
|
|
||||||
MyUint8Array,
|
|
||||||
MyFloat32Array
|
|
||||||
];
|
|
||||||
|
|
||||||
if (typeof BigInt !== 'undefined') {
|
if (typeof MyBigInt64Array !== 'undefined') {
|
||||||
ctors.push(MyBigInt64Array);
|
ctors.push(MyBigInt64Array);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +120,7 @@ function TestIterationAndResize(iterable, expected, rab, resizeAfter, newByteLen
|
|||||||
let resized = false;
|
let resized = false;
|
||||||
var arrayValues = false;
|
var arrayValues = false;
|
||||||
|
|
||||||
for (const value of iterable) {
|
for (let value of iterable) {
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
arrayValues = true;
|
arrayValues = true;
|
||||||
values.push([
|
values.push([
|
||||||
|
Loading…
x
Reference in New Issue
Block a user