| 1 |
// GENERATED, DO NOT EDIT |
| 2 |
// file: assertRelativeDateMs.js |
| 3 |
// Copyright (C) 2015 the V8 project authors. All rights reserved. |
| 4 |
// This code is governed by the BSD license found in the LICENSE file. |
| 5 |
/*--- |
| 6 |
description: | |
| 7 |
Verify that the given date object's Number representation describes the |
| 8 |
correct number of milliseconds since the Unix epoch relative to the local |
| 9 |
time zone (as interpreted at the specified date). |
| 10 |
defines: [assertRelativeDateMs] |
| 11 |
---*/ |
| 12 |
|
| 13 |
/** |
| 14 |
* @param {Date} date |
| 15 |
* @param {Number} expectedMs |
| 16 |
*/ |
| 17 |
function assertRelativeDateMs(date, expectedMs) { |
| 18 |
var actualMs = date.valueOf(); |
| 19 |
var localOffset = date.getTimezoneOffset() * 60000; |
| 20 |
|
| 21 |
if (actualMs - localOffset !== expectedMs) { |
| 22 |
throw new Test262Error( |
| 23 |
'Expected ' + date + ' to be ' + expectedMs + |
| 24 |
' milliseconds from the Unix epoch' |
| 25 |
); |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
// file: asyncHelpers.js |
| 30 |
// Copyright (C) 2022 Igalia, S.L. All rights reserved. |
| 31 |
// This code is governed by the BSD license found in the LICENSE file. |
| 32 |
/*--- |
| 33 |
description: | |
| 34 |
A collection of assertion and wrapper functions for testing asynchronous built-ins. |
| 35 |
defines: [asyncTest, assert.throwsAsync] |
| 36 |
---*/ |
| 37 |
|
| 38 |
/** |
| 39 |
* Defines the **sole** asynchronous test of a file. |
| 40 |
* @see {@link ../docs/rfcs/async-helpers.md} for background. |
| 41 |
* |
| 42 |
* @param {Function} testFunc a callback whose returned promise indicates test results |
| 43 |
* (fulfillment for success, rejection for failure) |
| 44 |
* @returns {void} |
| 45 |
*/ |
| 46 |
function asyncTest(testFunc) { |
| 47 |
if (!Object.prototype.hasOwnProperty.call(globalThis, "$DONE")) { |
| 48 |
throw new Test262Error("asyncTest called without async flag"); |
| 49 |
} |
| 50 |
if (typeof testFunc !== "function") { |
| 51 |
$DONE(new Test262Error("asyncTest called with non-function argument")); |
| 52 |
return; |
| 53 |
} |
| 54 |
try { |
| 55 |
testFunc().then( |
| 56 |
function () { |
| 57 |
$DONE(); |
| 58 |
}, |
| 59 |
function (error) { |
| 60 |
$DONE(error); |
| 61 |
} |
| 62 |
); |
| 63 |
} catch (syncError) { |
| 64 |
$DONE(syncError); |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
/** |
| 69 |
* Asserts that a callback asynchronously throws an instance of a particular |
| 70 |
* error (i.e., returns a promise whose rejection value is an object referencing |
| 71 |
* the constructor). |
| 72 |
* |
| 73 |
* @param {Function} expectedErrorConstructor the expected constructor of the |
| 74 |
* rejection value |
| 75 |
* @param {Function} func the callback |
| 76 |
* @param {string} [message] the prefix to use for failure messages |
| 77 |
* @returns {Promise<void>} fulfills if the expected error is thrown, |
| 78 |
* otherwise rejects |
| 79 |
*/ |
| 80 |
assert.throwsAsync = function (expectedErrorConstructor, func, message) { |
| 81 |
return new Promise(function (resolve) { |
| 82 |
var fail = function (detail) { |
| 83 |
if (message === undefined) { |
| 84 |
throw new Test262Error(detail); |
| 85 |
} |
| 86 |
throw new Test262Error(message + " " + detail); |
| 87 |
}; |
| 88 |
if (typeof expectedErrorConstructor !== "function") { |
| 89 |
fail("assert.throwsAsync called with an argument that is not an error constructor"); |
| 90 |
} |
| 91 |
if (typeof func !== "function") { |
| 92 |
fail("assert.throwsAsync called with an argument that is not a function"); |
| 93 |
} |
| 94 |
var expectedName = expectedErrorConstructor.name; |
| 95 |
var expectation = "Expected a " + expectedName + " to be thrown asynchronously"; |
| 96 |
var res; |
| 97 |
try { |
| 98 |
res = func(); |
| 99 |
} catch (thrown) { |
| 100 |
fail(expectation + " but the function threw synchronously"); |
| 101 |
} |
| 102 |
if (res === null || typeof res !== "object" || typeof res.then !== "function") { |
| 103 |
fail(expectation + " but result was not a thenable"); |
| 104 |
} |
| 105 |
var onResFulfilled, onResRejected; |
| 106 |
var resSettlementP = new Promise(function (onFulfilled, onRejected) { |
| 107 |
onResFulfilled = onFulfilled; |
| 108 |
onResRejected = onRejected; |
| 109 |
}); |
| 110 |
try { |
| 111 |
res.then(onResFulfilled, onResRejected) |
| 112 |
} catch (thrown) { |
| 113 |
fail(expectation + " but .then threw synchronously"); |
| 114 |
} |
| 115 |
resolve(resSettlementP.then( |
| 116 |
function () { |
| 117 |
fail(expectation + " but no exception was thrown at all"); |
| 118 |
}, |
| 119 |
function (thrown) { |
| 120 |
var actualName; |
| 121 |
if (thrown === null || typeof thrown !== "object") { |
| 122 |
fail(expectation + " but thrown value was not an object"); |
| 123 |
} else if (thrown.constructor !== expectedErrorConstructor) { |
| 124 |
actualName = thrown.constructor.name; |
| 125 |
if (expectedName === actualName) { |
| 126 |
fail(expectation + |
| 127 |
" but got a different error constructor with the same name"); |
| 128 |
} |
| 129 |
fail(expectation + " but got a " + actualName); |
| 130 |
} |
| 131 |
} |
| 132 |
)); |
| 133 |
}); |
| 134 |
}; |
| 135 |
|
| 136 |
// file: byteConversionValues.js |
| 137 |
// Copyright (C) 2016 the V8 project authors. All rights reserved. |
| 138 |
// This code is governed by the BSD license found in the LICENSE file. |
| 139 |
/*--- |
| 140 |
description: | |
| 141 |
Provide a list for original and expected values for different byte |
| 142 |
conversions. |
| 143 |
This helper is mostly used on tests for TypedArray and DataView, and each |
| 144 |
array from the expected values must match the original values array on every |
| 145 |
index containing its original value. |
| 146 |
defines: [byteConversionValues] |
| 147 |
---*/ |
| 148 |
var byteConversionValues = { |
| 149 |
values: [ |
| 150 |
127, // 2 ** 7 - 1 |
| 151 |
128, // 2 ** 7 |
| 152 |
32767, // 2 ** 15 - 1 |
| 153 |
32768, // 2 ** 15 |
| 154 |
2147483647, // 2 ** 31 - 1 |
| 155 |
2147483648, // 2 ** 31 |
| 156 |
255, // 2 ** 8 - 1 |
| 157 |
256, // 2 ** 8 |
| 158 |
65535, // 2 ** 16 - 1 |
| 159 |
65536, // 2 ** 16 |
| 160 |
4294967295, // 2 ** 32 - 1 |
| 161 |
4294967296, // 2 ** 32 |
| 162 |
9007199254740991, // 2 ** 53 - 1 |
| 163 |
9007199254740992, // 2 ** 53 |
| 164 |
1.1, |
| 165 |
0.1, |
| 166 |
0.5, |
| 167 |
0.50000001, |
| 168 |
0.6, |
| 169 |
0.7, |
| 170 |
undefined, |
| 171 |
-1, |
| 172 |
-0, |
| 173 |
-0.1, |
| 174 |
-1.1, |
| 175 |
NaN, |
| 176 |
-127, // - ( 2 ** 7 - 1 ) |
| 177 |
-128, // - ( 2 ** 7 ) |
| 178 |
-32767, // - ( 2 ** 15 - 1 ) |
| 179 |
-32768, // - ( 2 ** 15 ) |
| 180 |
-2147483647, // - ( 2 ** 31 - 1 ) |
| 181 |
-2147483648, // - ( 2 ** 31 ) |
| 182 |
-255, // - ( 2 ** 8 - 1 ) |
| 183 |
-256, // - ( 2 ** 8 ) |
| 184 |
-65535, // - ( 2 ** 16 - 1 ) |
| 185 |
-65536, // - ( 2 ** 16 ) |
| 186 |
-4294967295, // - ( 2 ** 32 - 1 ) |
| 187 |
-4294967296, // - ( 2 ** 32 ) |
| 188 |
Infinity, |
| 189 |
-Infinity, |
| 190 |
0, |
| 191 |
2049, // an integer which rounds down under ties-to-even when cast to float16 |
| 192 |
2051, // an integer which rounds up under ties-to-even when cast to float16 |
| 193 |
0.00006103515625, // smallest normal float16 |
| 194 |
0.00006097555160522461, // largest subnormal float16 |
| 195 |
5.960464477539063e-8, // smallest float16 |
| 196 |
2.9802322387695312e-8, // largest double which rounds to 0 when cast to float16 |
| 197 |
2.980232238769532e-8, // smallest double which does not round to 0 when cast to float16 |
| 198 |
8.940696716308594e-8, // a double which rounds up to a subnormal under ties-to-even when cast to float16 |
| 199 |
1.4901161193847656e-7, // a double which rounds down to a subnormal under ties-to-even when cast to float16 |
| 200 |
1.490116119384766e-7, // the next double above the one on the previous line one |
| 201 |
65504, // max finite float16 |
| 202 |
65520, // smallest double which rounds to infinity when cast to float16 |
| 203 |
65519.99999999999, // largest double which does not round to infinity when cast to float16 |
| 204 |
0.000061005353927612305, // smallest double which rounds to a non-subnormal when cast to float16 |
| 205 |
0.0000610053539276123 // largest double which rounds to a subnormal when cast to float16 |
| 206 |
], |
| 207 |
|
| 208 |
expected: { |
| 209 |
Int8: [ |
| 210 |
127, // 127 |
| 211 |
-128, // 128 |
| 212 |
-1, // 32767 |
| 213 |
0, // 32768 |
| 214 |
-1, // 2147483647 |
| 215 |
0, // 2147483648 |
| 216 |
-1, // 255 |
| 217 |
0, // 256 |
| 218 |
-1, // 65535 |
| 219 |
0, // 65536 |
| 220 |
-1, // 4294967295 |
| 221 |
0, // 4294967296 |
| 222 |
-1, // 9007199254740991 |
| 223 |
0, // 9007199254740992 |
| 224 |
1, // 1.1 |
| 225 |
0, // 0.1 |
| 226 |
0, // 0.5 |
| 227 |
0, // 0.50000001, |
| 228 |
0, // 0.6 |
| 229 |
0, // 0.7 |
| 230 |
0, // undefined |
| 231 |
-1, // -1 |
| 232 |
0, // -0 |
| 233 |
0, // -0.1 |
| 234 |
-1, // -1.1 |
| 235 |
0, // NaN |
| 236 |
-127, // -127 |
| 237 |
-128, // -128 |
| 238 |
1, // -32767 |
| 239 |
0, // -32768 |
| 240 |
1, // -2147483647 |
| 241 |
0, // -2147483648 |
| 242 |
1, // -255 |
| 243 |
0, // -256 |
| 244 |
1, // -65535 |
| 245 |
0, // -65536 |
| 246 |
1, // -4294967295 |
| 247 |
0, // -4294967296 |
| 248 |
0, // Infinity |
| 249 |
0, // -Infinity |
| 250 |
0, // 0 |
| 251 |
1, // 2049 |
| 252 |
3, // 2051 |
| 253 |
0, // 0.00006103515625 |
| 254 |
0, // 0.00006097555160522461 |
| 255 |
0, // 5.960464477539063e-8 |
| 256 |
0, // 2.9802322387695312e-8 |
| 257 |
0, // 2.980232238769532e-8 |
| 258 |
0, // 8.940696716308594e-8 |
| 259 |
0, // 1.4901161193847656e-7 |
| 260 |
0, // 1.490116119384766e-7 |
| 261 |
-32, // 65504 |
| 262 |
-16, // 65520 |
| 263 |
-17, // 65519.99999999999 |
| 264 |
0, // 0.000061005353927612305 |
| 265 |
0 // 0.0000610053539276123 |
| 266 |
], |
| 267 |
Uint8: [ |
| 268 |
127, // 127 |
| 269 |
128, // 128 |
| 270 |
255, // 32767 |
| 271 |
0, // 32768 |
| 272 |
255, // 2147483647 |
| 273 |
0, // 2147483648 |
| 274 |
255, // 255 |
| 275 |
0, // 256 |
| 276 |
255, // 65535 |
| 277 |
0, // 65536 |
| 278 |
255, // 4294967295 |
| 279 |
0, // 4294967296 |
| 280 |
255, // 9007199254740991 |
| 281 |
0, // 9007199254740992 |
| 282 |
1, // 1.1 |
| 283 |
0, // 0.1 |
| 284 |
0, // 0.5 |
| 285 |
0, // 0.50000001, |
| 286 |
0, // 0.6 |
| 287 |
0, // 0.7 |
| 288 |
0, // undefined |
| 289 |
255, // -1 |
| 290 |
0, // -0 |
| 291 |
0, // -0.1 |
| 292 |
255, // -1.1 |
| 293 |
0, // NaN |
| 294 |
129, // -127 |
| 295 |
128, // -128 |
| 296 |
1, // -32767 |
| 297 |
0, // -32768 |
| 298 |
1, // -2147483647 |
| 299 |
0, // -2147483648 |
| 300 |
1, // -255 |
| 301 |
0, // -256 |
| 302 |
1, // -65535 |
| 303 |
0, // -65536 |
| 304 |
1, // -4294967295 |
| 305 |
0, // -4294967296 |
| 306 |
0, // Infinity |
| 307 |
0, // -Infinity |
| 308 |
0, // 0 |
| 309 |
1, // 2049 |
| 310 |
3, // 2051 |
| 311 |
0, // 0.00006103515625 |
| 312 |
0, // 0.00006097555160522461 |
| 313 |
0, // 5.960464477539063e-8 |
| 314 |
0, // 2.9802322387695312e-8 |
| 315 |
0, // 2.980232238769532e-8 |
| 316 |
0, // 8.940696716308594e-8 |
| 317 |
0, // 1.4901161193847656e-7 |
| 318 |
0, // 1.490116119384766e-7 |
| 319 |
224, // 65504 |
| 320 |
240, // 65520 |
| 321 |
239, // 65519.99999999999 |
| 322 |
0, // 0.000061005353927612305 |
| 323 |
0 // 0.0000610053539276123 |
| 324 |
], |
| 325 |
Uint8Clamped: [ |
| 326 |
127, // 127 |
| 327 |
128, // 128 |
| 328 |
255, // 32767 |
| 329 |
255, // 32768 |
| 330 |
255, // 2147483647 |
| 331 |
255, // 2147483648 |
| 332 |
255, // 255 |
| 333 |
255, // 256 |
| 334 |
255, // 65535 |
| 335 |
255, // 65536 |
| 336 |
255, // 4294967295 |
| 337 |
255, // 4294967296 |
| 338 |
255, // 9007199254740991 |
| 339 |
255, // 9007199254740992 |
| 340 |
1, // 1.1, |
| 341 |
0, // 0.1 |
| 342 |
0, // 0.5 |
| 343 |
1, // 0.50000001, |
| 344 |
1, // 0.6 |
| 345 |
1, // 0.7 |
| 346 |
0, // undefined |
| 347 |
0, // -1 |
| 348 |
0, // -0 |
| 349 |
0, // -0.1 |
| 350 |
0, // -1.1 |
| 351 |
0, // NaN |
| 352 |
0, // -127 |
| 353 |
0, // -128 |
| 354 |
0, // -32767 |
| 355 |
0, // -32768 |
| 356 |
0, // -2147483647 |
| 357 |
0, // -2147483648 |
| 358 |
0, // -255 |
| 359 |
0, // -256 |
| 360 |
0, // -65535 |
| 361 |
0, // -65536 |
| 362 |
0, // -4294967295 |
| 363 |
0, // -4294967296 |
| 364 |
255, // Infinity |
| 365 |
0, // -Infinity |
| 366 |
0, // 0 |
| 367 |
255, // 2049 |
| 368 |
255, // 2051 |
| 369 |
0, // 0.00006103515625 |
| 370 |
0, // 0.00006097555160522461 |
| 371 |
0, // 5.960464477539063e-8 |
| 372 |
0, // 2.9802322387695312e-8 |
| 373 |
0, // 2.980232238769532e-8 |
| 374 |
0, // 8.940696716308594e-8 |
| 375 |
0, // 1.4901161193847656e-7 |
| 376 |
0, // 1.490116119384766e-7 |
| 377 |
255, // 65504 |
| 378 |
255, // 65520 |
| 379 |
255, // 65519.99999999999 |
| 380 |
0, // 0.000061005353927612305 |
| 381 |
0 // 0.0000610053539276123 |
| 382 |
], |
| 383 |
Int16: [ |
| 384 |
127, // 127 |
| 385 |
128, // 128 |
| 386 |
32767, // 32767 |
| 387 |
-32768, // 32768 |
| 388 |
-1, // 2147483647 |
| 389 |
0, // 2147483648 |
| 390 |
255, // 255 |
| 391 |
256, // 256 |
| 392 |
-1, // 65535 |
| 393 |
0, // 65536 |
| 394 |
-1, // 4294967295 |
| 395 |
0, // 4294967296 |
| 396 |
-1, // 9007199254740991 |
| 397 |
0, // 9007199254740992 |
| 398 |
1, // 1.1 |
| 399 |
0, // 0.1 |
| 400 |
0, // 0.5 |
| 401 |
0, // 0.50000001, |
| 402 |
0, // 0.6 |
| 403 |
0, // 0.7 |
| 404 |
0, // undefined |
| 405 |
-1, // -1 |
| 406 |
0, // -0 |
| 407 |
0, // -0.1 |
| 408 |
-1, // -1.1 |
| 409 |
0, // NaN |
| 410 |
-127, // -127 |
| 411 |
-128, // -128 |
| 412 |
-32767, // -32767 |
| 413 |
-32768, // -32768 |
| 414 |
1, // -2147483647 |
| 415 |
0, // -2147483648 |
| 416 |
-255, // -255 |
| 417 |
-256, // -256 |
| 418 |
1, // -65535 |
| 419 |
0, // -65536 |
| 420 |
1, // -4294967295 |
| 421 |
0, // -4294967296 |
| 422 |
0, // Infinity |
| 423 |
0, // -Infinity |
| 424 |
0, // 0 |
| 425 |
2049, // 2049 |
| 426 |
2051, // 2051 |
| 427 |
0, // 0.00006103515625 |
| 428 |
0, // 0.00006097555160522461 |
| 429 |
0, // 5.960464477539063e-8 |
| 430 |
0, // 2.9802322387695312e-8 |
| 431 |
0, // 2.980232238769532e-8 |
| 432 |
0, // 8.940696716308594e-8 |
| 433 |
0, // 1.4901161193847656e-7 |
| 434 |
0, // 1.490116119384766e-7 |
| 435 |
-32, // 65504 |
| 436 |
-16, // 65520 |
| 437 |
-17, // 65519.99999999999 |
| 438 |
0, // 0.000061005353927612305 |
| 439 |
0 // 0.0000610053539276123 |
| 440 |
], |
| 441 |
Uint16: [ |
| 442 |
127, // 127 |
| 443 |
128, // 128 |
| 444 |
32767, // 32767 |
| 445 |
32768, // 32768 |
| 446 |
65535, // 2147483647 |
| 447 |
0, // 2147483648 |
| 448 |
255, // 255 |
| 449 |
256, // 256 |
| 450 |
65535, // 65535 |
| 451 |
0, // 65536 |
| 452 |
65535, // 4294967295 |
| 453 |
0, // 4294967296 |
| 454 |
65535, // 9007199254740991 |
| 455 |
0, // 9007199254740992 |
| 456 |
1, // 1.1 |
| 457 |
0, // 0.1 |
| 458 |
0, // 0.5 |
| 459 |
0, // 0.50000001, |
| 460 |
0, // 0.6 |
| 461 |
0, // 0.7 |
| 462 |
0, // undefined |
| 463 |
65535, // -1 |
| 464 |
0, // -0 |
| 465 |
0, // -0.1 |
| 466 |
65535, // -1.1 |
| 467 |
0, // NaN |
| 468 |
65409, // -127 |
| 469 |
65408, // -128 |
| 470 |
32769, // -32767 |
| 471 |
32768, // -32768 |
| 472 |
1, // -2147483647 |
| 473 |
0, // -2147483648 |
| 474 |
65281, // -255 |
| 475 |
65280, // -256 |
| 476 |
1, // -65535 |
| 477 |
0, // -65536 |
| 478 |
1, // -4294967295 |
| 479 |
0, // -4294967296 |
| 480 |
0, // Infinity |
| 481 |
0, // -Infinity |
| 482 |
0, // 0 |
| 483 |
2049, // 2049 |
| 484 |
2051, // 2051 |
| 485 |
0, // 0.00006103515625 |
| 486 |
0, // 0.00006097555160522461 |
| 487 |
0, // 5.960464477539063e-8 |
| 488 |
0, // 2.9802322387695312e-8 |
| 489 |
0, // 2.980232238769532e-8 |
| 490 |
0, // 8.940696716308594e-8 |
| 491 |
0, // 1.4901161193847656e-7 |
| 492 |
0, // 1.490116119384766e-7 |
| 493 |
65504, // 65504 |
| 494 |
65520, // 65520 |
| 495 |
65519, // 65519.99999999999 |
| 496 |
0, // 0.000061005353927612305 |
| 497 |
0 // 0.0000610053539276123 |
| 498 |
], |
| 499 |
Int32: [ |
| 500 |
127, // 127 |
| 501 |
128, // 128 |
| 502 |
32767, // 32767 |
| 503 |
32768, // 32768 |
| 504 |
2147483647, // 2147483647 |
| 505 |
-2147483648, // 2147483648 |
| 506 |
255, // 255 |
| 507 |
256, // 256 |
| 508 |
65535, // 65535 |
| 509 |
65536, // 65536 |
| 510 |
-1, // 4294967295 |
| 511 |
0, // 4294967296 |
| 512 |
-1, // 9007199254740991 |
| 513 |
0, // 9007199254740992 |
| 514 |
1, // 1.1 |
| 515 |
0, // 0.1 |
| 516 |
0, // 0.5 |
| 517 |
0, // 0.50000001, |
| 518 |
0, // 0.6 |
| 519 |
0, // 0.7 |
| 520 |
0, // undefined |
| 521 |
-1, // -1 |
| 522 |
0, // -0 |
| 523 |
0, // -0.1 |
| 524 |
-1, // -1.1 |
| 525 |
0, // NaN |
| 526 |
-127, // -127 |
| 527 |
-128, // -128 |
| 528 |
-32767, // -32767 |
| 529 |
-32768, // -32768 |
| 530 |
-2147483647, // -2147483647 |
| 531 |
-2147483648, // -2147483648 |
| 532 |
-255, // -255 |
| 533 |
-256, // -256 |
| 534 |
-65535, // -65535 |
| 535 |
-65536, // -65536 |
| 536 |
1, // -4294967295 |
| 537 |
0, // -4294967296 |
| 538 |
0, // Infinity |
| 539 |
0, // -Infinity |
| 540 |
0, // 0 |
| 541 |
2049, // 2049 |
| 542 |
2051, // 2051 |
| 543 |
0, // 0.00006103515625 |
| 544 |
0, // 0.00006097555160522461 |
| 545 |
0, // 5.960464477539063e-8 |
| 546 |
0, // 2.9802322387695312e-8 |
| 547 |
0, // 2.980232238769532e-8 |
| 548 |
0, // 8.940696716308594e-8 |
| 549 |
0, // 1.4901161193847656e-7 |
| 550 |
0, // 1.490116119384766e-7 |
| 551 |
65504, // 65504 |
| 552 |
65520, // 65520 |
| 553 |
65519, // 65519.99999999999 |
| 554 |
0, // 0.000061005353927612305 |
| 555 |
0 // 0.0000610053539276123 |
| 556 |
], |
| 557 |
Uint32: [ |
| 558 |
127, // 127 |
| 559 |
128, // 128 |
| 560 |
32767, // 32767 |
| 561 |
32768, // 32768 |
| 562 |
2147483647, // 2147483647 |
| 563 |
2147483648, // 2147483648 |
| 564 |
255, // 255 |
| 565 |
256, // 256 |
| 566 |
65535, // 65535 |
| 567 |
65536, // 65536 |
| 568 |
4294967295, // 4294967295 |
| 569 |
0, // 4294967296 |
| 570 |
4294967295, // 9007199254740991 |
| 571 |
0, // 9007199254740992 |
| 572 |
1, // 1.1 |
| 573 |
0, // 0.1 |
| 574 |
0, // 0.5 |
| 575 |
0, // 0.50000001, |
| 576 |
0, // 0.6 |
| 577 |
0, // 0.7 |
| 578 |
0, // undefined |
| 579 |
4294967295, // -1 |
| 580 |
0, // -0 |
| 581 |
0, // -0.1 |
| 582 |
4294967295, // -1.1 |
| 583 |
0, // NaN |
| 584 |
4294967169, // -127 |
| 585 |
4294967168, // -128 |
| 586 |
4294934529, // -32767 |
| 587 |
4294934528, // -32768 |
| 588 |
2147483649, // -2147483647 |
| 589 |
2147483648, // -2147483648 |
| 590 |
4294967041, // -255 |
| 591 |
4294967040, // -256 |
| 592 |
4294901761, // -65535 |
| 593 |
4294901760, // -65536 |
| 594 |
1, // -4294967295 |
| 595 |
0, // -4294967296 |
| 596 |
0, // Infinity |
| 597 |
0, // -Infinity |
| 598 |
0, // 0 |
| 599 |
2049, // 2049 |
| 600 |
2051, // 2051 |
| 601 |
0, // 0.00006103515625 |
| 602 |
0, // 0.00006097555160522461 |
| 603 |
0, // 5.960464477539063e-8 |
| 604 |
0, // 2.9802322387695312e-8 |
| 605 |
0, // 2.980232238769532e-8 |
| 606 |
0, // 8.940696716308594e-8 |
| 607 |
0, // 1.4901161193847656e-7 |
| 608 |
0, // 1.490116119384766e-7 |
| 609 |
65504, // 65504 |
| 610 |
65520, // 65520 |
| 611 |
65519, // 65519.99999999999 |
| 612 |
0, // 0.000061005353927612305 |
| 613 |
0 // 0.0000610053539276123 |
| 614 |
], |
| 615 |
Float16: [ |
| 616 |
127, // 127 |
| 617 |
128, // 128 |
| 618 |
32768, // 32767 |
| 619 |
32768, // 32768 |
| 620 |
Infinity, // 2147483647 |
| 621 |
Infinity, // 2147483648 |
| 622 |
255, // 255 |
| 623 |
256, // 256 |
| 624 |
Infinity, // 65535 |
| 625 |
Infinity, // 65536 |
| 626 |
Infinity, // 4294967295 |
| 627 |
Infinity, // 4294967296 |
| 628 |
Infinity, // 9007199254740991 |
| 629 |
Infinity, // 9007199254740992 |
| 630 |
1.099609375, // 1.1 |
| 631 |
0.0999755859375, // 0.1 |
| 632 |
0.5, // 0.5 |
| 633 |
0.5, // 0.50000001, |
| 634 |
0.60009765625, // 0.6 |
| 635 |
0.7001953125, // 0.7 |
| 636 |
NaN, // undefined |
| 637 |
-1, // -1 |
| 638 |
-0, // -0 |
| 639 |
-0.0999755859375, // -0.1 |
| 640 |
-1.099609375, // -1.1 |
| 641 |
NaN, // NaN |
| 642 |
-127, // -127 |
| 643 |
-128, // -128 |
| 644 |
-32768, // -32767 |
| 645 |
-32768, // -32768 |
| 646 |
-Infinity, // -2147483647 |
| 647 |
-Infinity, // -2147483648 |
| 648 |
-255, // -255 |
| 649 |
-256, // -256 |
| 650 |
-Infinity, // -65535 |
| 651 |
-Infinity, // -65536 |
| 652 |
-Infinity, // -4294967295 |
| 653 |
-Infinity, // -4294967296 |
| 654 |
Infinity, // Infinity |
| 655 |
-Infinity, // -Infinity |
| 656 |
0, // 0 |
| 657 |
2048, // 2049 |
| 658 |
2052, // 2051 |
| 659 |
0.00006103515625, // 0.00006103515625 |
| 660 |
0.00006097555160522461, // 0.00006097555160522461 |
| 661 |
5.960464477539063e-8, // 5.960464477539063e-8 |
| 662 |
0, // 2.9802322387695312e-8 |
| 663 |
5.960464477539063e-8, // 2.980232238769532e-8 |
| 664 |
1.1920928955078125e-7, // 8.940696716308594e-8 |
| 665 |
1.1920928955078125e-7, // 1.4901161193847656e-7 |
| 666 |
1.7881393432617188e-7, // 1.490116119384766e-7 |
| 667 |
65504, // 65504 |
| 668 |
Infinity, // 65520 |
| 669 |
65504, // 65519.99999999999 |
| 670 |
0.00006103515625, // 0.000061005353927612305 |
| 671 |
0.00006097555160522461 // 0.0000610053539276123 |
| 672 |
], |
| 673 |
Float32: [ |
| 674 |
127, // 127 |
| 675 |
128, // 128 |
| 676 |
32767, // 32767 |
| 677 |
32768, // 32768 |
| 678 |
2147483648, // 2147483647 |
| 679 |
2147483648, // 2147483648 |
| 680 |
255, // 255 |
| 681 |
256, // 256 |
| 682 |
65535, // 65535 |
| 683 |
65536, // 65536 |
| 684 |
4294967296, // 4294967295 |
| 685 |
4294967296, // 4294967296 |
| 686 |
9007199254740992, // 9007199254740991 |
| 687 |
9007199254740992, // 9007199254740992 |
| 688 |
1.100000023841858, // 1.1 |
| 689 |
0.10000000149011612, // 0.1 |
| 690 |
0.5, // 0.5 |
| 691 |
0.5, // 0.50000001, |
| 692 |
0.6000000238418579, // 0.6 |
| 693 |
0.699999988079071, // 0.7 |
| 694 |
NaN, // undefined |
| 695 |
-1, // -1 |
| 696 |
-0, // -0 |
| 697 |
-0.10000000149011612, // -0.1 |
| 698 |
-1.100000023841858, // -1.1 |
| 699 |
NaN, // NaN |
| 700 |
-127, // -127 |
| 701 |
-128, // -128 |
| 702 |
-32767, // -32767 |
| 703 |
-32768, // -32768 |
| 704 |
-2147483648, // -2147483647 |
| 705 |
-2147483648, // -2147483648 |
| 706 |
-255, // -255 |
| 707 |
-256, // -256 |
| 708 |
-65535, // -65535 |
| 709 |
-65536, // -65536 |
| 710 |
-4294967296, // -4294967295 |
| 711 |
-4294967296, // -4294967296 |
| 712 |
Infinity, // Infinity |
| 713 |
-Infinity, // -Infinity |
| 714 |
0, // 0 |
| 715 |
2049, // 2049 |
| 716 |
2051, // 2051 |
| 717 |
0.00006103515625, // 0.00006103515625 |
| 718 |
0.00006097555160522461, // 0.00006097555160522461 |
| 719 |
5.960464477539063e-8, // 5.960464477539063e-8 |
| 720 |
2.9802322387695312e-8, // 2.9802322387695312e-8 |
| 721 |
2.9802322387695312e-8, // 2.980232238769532e-8 |
| 722 |
8.940696716308594e-8, // 8.940696716308594e-8 |
| 723 |
1.4901161193847656e-7, // 1.4901161193847656e-7 |
| 724 |
1.4901161193847656e-7, // 1.490116119384766e-7 |
| 725 |
65504, // 65504 |
| 726 |
65520, // 65520 |
| 727 |
65520, // 65519.99999999999 |
| 728 |
0.000061005353927612305, // 0.000061005353927612305 |
| 729 |
0.000061005353927612305 // 0.0000610053539276123 |
| 730 |
], |
| 731 |
Float64: [ |
| 732 |
127, // 127 |
| 733 |
128, // 128 |
| 734 |
32767, // 32767 |
| 735 |
32768, // 32768 |
| 736 |
2147483647, // 2147483647 |
| 737 |
2147483648, // 2147483648 |
| 738 |
255, // 255 |
| 739 |
256, // 256 |
| 740 |
65535, // 65535 |
| 741 |
65536, // 65536 |
| 742 |
4294967295, // 4294967295 |
| 743 |
4294967296, // 4294967296 |
| 744 |
9007199254740991, // 9007199254740991 |
| 745 |
9007199254740992, // 9007199254740992 |
| 746 |
1.1, // 1.1 |
| 747 |
0.1, // 0.1 |
| 748 |
0.5, // 0.5 |
| 749 |
0.50000001, // 0.50000001, |
| 750 |
0.6, // 0.6 |
| 751 |
0.7, // 0.7 |
| 752 |
NaN, // undefined |
| 753 |
-1, // -1 |
| 754 |
-0, // -0 |
| 755 |
-0.1, // -0.1 |
| 756 |
-1.1, // -1.1 |
| 757 |
NaN, // NaN |
| 758 |
-127, // -127 |
| 759 |
-128, // -128 |
| 760 |
-32767, // -32767 |
| 761 |
-32768, // -32768 |
| 762 |
-2147483647, // -2147483647 |
| 763 |
-2147483648, // -2147483648 |
| 764 |
-255, // -255 |
| 765 |
-256, // -256 |
| 766 |
-65535, // -65535 |
| 767 |
-65536, // -65536 |
| 768 |
-4294967295, // -4294967295 |
| 769 |
-4294967296, // -4294967296 |
| 770 |
Infinity, // Infinity |
| 771 |
-Infinity, // -Infinity |
| 772 |
0, // 0 |
| 773 |
2049, // 2049 |
| 774 |
2051, // 2051 |
| 775 |
0.00006103515625, // 0.00006103515625 |
| 776 |
0.00006097555160522461, // 0.00006097555160522461 |
| 777 |
5.960464477539063e-8, // 5.960464477539063e-8 |
| 778 |
2.9802322387695312e-8, // 2.9802322387695312e-8 |
| 779 |
2.980232238769532e-8, // 2.980232238769532e-8 |
| 780 |
8.940696716308594e-8, // 8.940696716308594e-8 |
| 781 |
1.4901161193847656e-7, // 1.4901161193847656e-7 |
| 782 |
1.490116119384766e-7, // 1.490116119384766e-7 |
| 783 |
65504, // 65504 |
| 784 |
65520, // 65520 |
| 785 |
65519.99999999999, // 65519.99999999999 |
| 786 |
0.000061005353927612305, // 0.000061005353927612305 |
| 787 |
0.0000610053539276123 // 0.0000610053539276123 |
| 788 |
] |
| 789 |
} |
| 790 |
}; |
| 791 |
|
| 792 |
// file: dateConstants.js |
| 793 |
// Copyright (C) 2009 the Sputnik authors. All rights reserved. |
| 794 |
// This code is governed by the BSD license found in the LICENSE file. |
| 795 |
/*--- |
| 796 |
description: | |
| 797 |
Collection of date-centric values |
| 798 |
defines: |
| 799 |
- date_1899_end |
| 800 |
- date_1900_start |
| 801 |
- date_1969_end |
| 802 |
- date_1970_start |
| 803 |
- date_1999_end |
| 804 |
- date_2000_start |
| 805 |
- date_2099_end |
| 806 |
- date_2100_start |
| 807 |
- start_of_time |
| 808 |
- end_of_time |
| 809 |
---*/ |
| 810 |
|
| 811 |
var date_1899_end = -2208988800001; |
| 812 |
var date_1900_start = -2208988800000; |
| 813 |
var date_1969_end = -1; |
| 814 |
var date_1970_start = 0; |
| 815 |
var date_1999_end = 946684799999; |
| 816 |
var date_2000_start = 946684800000; |
| 817 |
var date_2099_end = 4102444799999; |
| 818 |
var date_2100_start = 4102444800000; |
| 819 |
|
| 820 |
var start_of_time = -8.64e15; |
| 821 |
var end_of_time = 8.64e15; |
| 822 |
|
| 823 |
// file: decimalToHexString.js |
| 824 |
// Copyright (C) 2017 André Bargull. All rights reserved. |
| 825 |
// This code is governed by the BSD license found in the LICENSE file. |
| 826 |
/*--- |
| 827 |
description: | |
| 828 |
Collection of functions used to assert the correctness of various encoding operations. |
| 829 |
defines: [decimalToHexString, decimalToPercentHexString] |
| 830 |
---*/ |
| 831 |
|
| 832 |
function decimalToHexString(n) { |
| 833 |
var hex = "0123456789ABCDEF"; |
| 834 |
n >>>= 0; |
| 835 |
var s = ""; |
| 836 |
while (n) { |
| 837 |
s = hex[n & 0xf] + s; |
| 838 |
n >>>= 4; |
| 839 |
} |
| 840 |
while (s.length < 4) { |
| 841 |
s = "0" + s; |
| 842 |
} |
| 843 |
return s; |
| 844 |
} |
| 845 |
|
| 846 |
function decimalToPercentHexString(n) { |
| 847 |
var hex = "0123456789ABCDEF"; |
| 848 |
return "%" + hex[(n >> 4) & 0xf] + hex[n & 0xf]; |
| 849 |
} |
| 850 |
|
| 851 |
// file: deepEqual.js |
| 852 |
// Copyright 2019 Ron Buckton. All rights reserved. |
| 853 |
// This code is governed by the BSD license found in the LICENSE file. |
| 854 |
/*--- |
| 855 |
description: > |
| 856 |
Compare two values structurally |
| 857 |
defines: [assert.deepEqual] |
| 858 |
---*/ |
| 859 |
|
| 860 |
assert.deepEqual = function(actual, expected, message) { |
| 861 |
var format = assert.deepEqual.format; |
| 862 |
var mustBeTrue = assert.deepEqual._compare(actual, expected); |
| 863 |
|
| 864 |
// format can be slow when `actual` or `expected` are large objects, like for |
| 865 |
// example the global object, so only call it when the assertion will fail. |
| 866 |
if (mustBeTrue !== true) { |
| 867 |
message = `Expected ${format(actual)} to be structurally equal to ${format(expected)}. ${(message || '')}`; |
| 868 |
} |
| 869 |
|
| 870 |
assert(mustBeTrue, message); |
| 871 |
}; |
| 872 |
|
| 873 |
(function() { |
| 874 |
let getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; |
| 875 |
let join = arr => arr.join(', '); |
| 876 |
function stringFromTemplate(strings, ...subs) { |
| 877 |
let parts = strings.map((str, i) => `${i === 0 ? '' : subs[i - 1]}${str}`); |
| 878 |
return parts.join(''); |
| 879 |
} |
| 880 |
function escapeKey(key) { |
| 881 |
if (typeof key === 'symbol') return `[${String(key)}]`; |
| 882 |
if (/^[a-zA-Z0-9_$]+$/.test(key)) return key; |
| 883 |
return assert._formatIdentityFreeValue(key); |
| 884 |
} |
| 885 |
|
| 886 |
assert.deepEqual.format = function(value, seen) { |
| 887 |
let basic = assert._formatIdentityFreeValue(value); |
| 888 |
if (basic) return basic; |
| 889 |
switch (value === null ? 'null' : typeof value) { |
| 890 |
case 'string': |
| 891 |
case 'bigint': |
| 892 |
case 'number': |
| 893 |
case 'boolean': |
| 894 |
case 'undefined': |
| 895 |
case 'null': |
| 896 |
assert(false, 'values without identity should use basic formatting'); |
| 897 |
break; |
| 898 |
case 'symbol': |
| 899 |
case 'function': |
| 900 |
case 'object': |
| 901 |
break; |
| 902 |
default: |
| 903 |
return typeof value; |
| 904 |
} |
| 905 |
|
| 906 |
if (!seen) { |
| 907 |
seen = { |
| 908 |
counter: 0, |
| 909 |
map: new Map() |
| 910 |
}; |
| 911 |
} |
| 912 |
let usage = seen.map.get(value); |
| 913 |
if (usage) { |
| 914 |
usage.used = true; |
| 915 |
return `ref #${usage.id}`; |
| 916 |
} |
| 917 |
usage = { id: ++seen.counter, used: false }; |
| 918 |
seen.map.set(value, usage); |
| 919 |
|
| 920 |
// Properly communicating multiple references requires deferred rendering of |
| 921 |
// all identity-bearing values until the outermost format call finishes, |
| 922 |
// because the current value can also in appear in a not-yet-visited part of |
| 923 |
// the object graph (which, when visited, will update the usage object). |
| 924 |
// |
| 925 |
// To preserve readability of the desired output formatting, we accomplish |
| 926 |
// this deferral using tagged template literals. |
| 927 |
// Evaluation closes over the usage object and returns a function that accepts |
| 928 |
// "mapper" arguments for rendering the corresponding substitution values and |
| 929 |
// returns an object with only a toString method which will itself be invoked |
| 930 |
// when trying to use the result as a string in assert.deepEqual. |
| 931 |
// |
| 932 |
// For convenience, any absent mapper is presumed to be `String`, and the |
| 933 |
// function itself has a toString method that self-invokes with no mappers |
| 934 |
// (allowing returning the function directly when every mapper is `String`). |
| 935 |
function lazyResult(strings, ...subs) { |
| 936 |
function acceptMappers(...mappers) { |
| 937 |
function toString() { |
| 938 |
let renderings = subs.map((sub, i) => (mappers[i] || String)(sub)); |
| 939 |
let rendered = stringFromTemplate(strings, ...renderings); |
| 940 |
if (usage.used) rendered += ` as #${usage.id}`; |
| 941 |
return rendered; |
| 942 |
} |
| 943 |
|
| 944 |
return { toString }; |
| 945 |
} |
| 946 |
|
| 947 |
acceptMappers.toString = () => String(acceptMappers()); |
| 948 |
return acceptMappers; |
| 949 |
} |
| 950 |
|
| 951 |
let format = assert.deepEqual.format; |
| 952 |
function lazyString(strings, ...subs) { |
| 953 |
return { toString: () => stringFromTemplate(strings, ...subs) }; |
| 954 |
} |
| 955 |
|
| 956 |
if (typeof value === 'function') { |
| 957 |
return lazyResult`function${value.name ? ` ${String(value.name)}` : ''}`; |
| 958 |
} |
| 959 |
if (typeof value !== 'object') { |
| 960 |
// probably a symbol |
| 961 |
return lazyResult`${value}`; |
| 962 |
} |
| 963 |
if (Array.isArray ? Array.isArray(value) : value instanceof Array) { |
| 964 |
return lazyResult`[${value.map(value => format(value, seen))}]`(join); |
| 965 |
} |
| 966 |
if (value instanceof Date) { |
| 967 |
return lazyResult`Date(${format(value.toISOString(), seen)})`; |
| 968 |
} |
| 969 |
if (value instanceof Error) { |
| 970 |
return lazyResult`error ${value.name || 'Error'}(${format(value.message, seen)})`; |
| 971 |
} |
| 972 |
if (value instanceof RegExp) { |
| 973 |
return lazyResult`${value}`; |
| 974 |
} |
| 975 |
if (typeof Map !== "undefined" && value instanceof Map) { |
| 976 |
let contents = Array.from(value).map(pair => lazyString`${format(pair[0], seen)} => ${format(pair[1], seen)}`); |
| 977 |
return lazyResult`Map {${contents}}`(join); |
| 978 |
} |
| 979 |
if (typeof Set !== "undefined" && value instanceof Set) { |
| 980 |
let contents = Array.from(value).map(value => format(value, seen)); |
| 981 |
return lazyResult`Set {${contents}}`(join); |
| 982 |
} |
| 983 |
|
| 984 |
let tag = Symbol.toStringTag && Symbol.toStringTag in value |
| 985 |
? value[Symbol.toStringTag] |
| 986 |
: Object.getPrototypeOf(value) === null ? '[Object: null prototype]' : 'Object'; |
| 987 |
let keys = Reflect.ownKeys(value).filter(key => getOwnPropertyDescriptor(value, key).enumerable); |
| 988 |
let contents = keys.map(key => lazyString`${escapeKey(key)}: ${format(value[key], seen)}`); |
| 989 |
return lazyResult`${tag ? `${tag} ` : ''}{${contents}}`(String, join); |
| 990 |
}; |
| 991 |
})(); |
| 992 |
|
| 993 |
assert.deepEqual._compare = (function () { |
| 994 |
var EQUAL = 1; |
| 995 |
var NOT_EQUAL = -1; |
| 996 |
var UNKNOWN = 0; |
| 997 |
|
| 998 |
function deepEqual(a, b) { |
| 999 |
return compareEquality(a, b) === EQUAL; |
| 1000 |
} |
| 1001 |
|
| 1002 |
function compareEquality(a, b, cache) { |
| 1003 |
return compareIf(a, b, isOptional, compareOptionality) |
| 1004 |
|| compareIf(a, b, isPrimitiveEquatable, comparePrimitiveEquality) |
| 1005 |
|| compareIf(a, b, isObjectEquatable, compareObjectEquality, cache) |
| 1006 |
|| NOT_EQUAL; |
| 1007 |
} |
| 1008 |
|
| 1009 |
function compareIf(a, b, test, compare, cache) { |
| 1010 |
return !test(a) |
| 1011 |
? !test(b) ? UNKNOWN : NOT_EQUAL |
| 1012 |
: !test(b) ? NOT_EQUAL : cacheComparison(a, b, compare, cache); |
| 1013 |
} |
| 1014 |
|
| 1015 |
function tryCompareStrictEquality(a, b) { |
| 1016 |
return a === b ? EQUAL : UNKNOWN; |
| 1017 |
} |
| 1018 |
|
| 1019 |
function tryCompareTypeOfEquality(a, b) { |
| 1020 |
return typeof a !== typeof b ? NOT_EQUAL : UNKNOWN; |
| 1021 |
} |
| 1022 |
|
| 1023 |
function tryCompareToStringTagEquality(a, b) { |
| 1024 |
var aTag = Symbol.toStringTag in a ? a[Symbol.toStringTag] : undefined; |
| 1025 |
var bTag = Symbol.toStringTag in b ? b[Symbol.toStringTag] : undefined; |
| 1026 |
return aTag !== bTag ? NOT_EQUAL : UNKNOWN; |
| 1027 |
} |
| 1028 |
|
| 1029 |
function isOptional(value) { |
| 1030 |
return value === undefined |
| 1031 |
|| value === null; |
| 1032 |
} |
| 1033 |
|
| 1034 |
function compareOptionality(a, b) { |
| 1035 |
return tryCompareStrictEquality(a, b) |
| 1036 |
|| NOT_EQUAL; |
| 1037 |
} |
| 1038 |
|
| 1039 |
function isPrimitiveEquatable(value) { |
| 1040 |
switch (typeof value) { |
| 1041 |
case 'string': |
| 1042 |
case 'number': |
| 1043 |
case 'bigint': |
| 1044 |
case 'boolean': |
| 1045 |
case 'symbol': |
| 1046 |
return true; |
| 1047 |
default: |
| 1048 |
return isBoxed(value); |
| 1049 |
} |
| 1050 |
} |
| 1051 |
|
| 1052 |
function comparePrimitiveEquality(a, b) { |
| 1053 |
if (isBoxed(a)) a = a.valueOf(); |
| 1054 |
if (isBoxed(b)) b = b.valueOf(); |
| 1055 |
return tryCompareStrictEquality(a, b) |
| 1056 |
|| tryCompareTypeOfEquality(a, b) |
| 1057 |
|| compareIf(a, b, isNaNEquatable, compareNaNEquality) |
| 1058 |
|| NOT_EQUAL; |
| 1059 |
} |
| 1060 |
|
| 1061 |
function isNaNEquatable(value) { |
| 1062 |
return typeof value === 'number'; |
| 1063 |
} |
| 1064 |
|
| 1065 |
function compareNaNEquality(a, b) { |
| 1066 |
return isNaN(a) && isNaN(b) ? EQUAL : NOT_EQUAL; |
| 1067 |
} |
| 1068 |
|
| 1069 |
function isObjectEquatable(value) { |
| 1070 |
return typeof value === 'object' || typeof value === 'function'; |
| 1071 |
} |
| 1072 |
|
| 1073 |
function compareObjectEquality(a, b, cache) { |
| 1074 |
if (!cache) cache = new Map(); |
| 1075 |
return getCache(cache, a, b) |
| 1076 |
|| setCache(cache, a, b, EQUAL) // consider equal for now |
| 1077 |
|| cacheComparison(a, b, tryCompareStrictEquality, cache) |
| 1078 |
|| cacheComparison(a, b, tryCompareToStringTagEquality, cache) |
| 1079 |
|| compareIf(a, b, isValueOfEquatable, compareValueOfEquality) |
| 1080 |
|| compareIf(a, b, isToStringEquatable, compareToStringEquality) |
| 1081 |
|| compareIf(a, b, isArrayLikeEquatable, compareArrayLikeEquality, cache) |
| 1082 |
|| compareIf(a, b, isStructurallyEquatable, compareStructuralEquality, cache) |
| 1083 |
|| compareIf(a, b, isIterableEquatable, compareIterableEquality, cache) |
| 1084 |
|| cacheComparison(a, b, fail, cache); |
| 1085 |
} |
| 1086 |
|
| 1087 |
function isBoxed(value) { |
| 1088 |
return value instanceof String |
| 1089 |
|| value instanceof Number |
| 1090 |
|| value instanceof Boolean |
| 1091 |
|| typeof Symbol === 'function' && value instanceof Symbol |
| 1092 |
|| typeof BigInt === 'function' && value instanceof BigInt; |
| 1093 |
} |
| 1094 |
|
| 1095 |
function isValueOfEquatable(value) { |
| 1096 |
return value instanceof Date; |
| 1097 |
} |
| 1098 |
|
| 1099 |
function compareValueOfEquality(a, b) { |
| 1100 |
return compareIf(a.valueOf(), b.valueOf(), isPrimitiveEquatable, comparePrimitiveEquality) |
| 1101 |
|| NOT_EQUAL; |
| 1102 |
} |
| 1103 |
|
| 1104 |
function isToStringEquatable(value) { |
| 1105 |
return value instanceof RegExp; |
| 1106 |
} |
| 1107 |
|
| 1108 |
function compareToStringEquality(a, b) { |
| 1109 |
return compareIf(a.toString(), b.toString(), isPrimitiveEquatable, comparePrimitiveEquality) |
| 1110 |
|| NOT_EQUAL; |
| 1111 |
} |
| 1112 |
|
| 1113 |
function isArrayLikeEquatable(value) { |
| 1114 |
return (Array.isArray ? Array.isArray(value) : value instanceof Array) |
| 1115 |
|| (typeof Uint8Array === 'function' && value instanceof Uint8Array) |
| 1116 |
|| (typeof Uint8ClampedArray === 'function' && value instanceof Uint8ClampedArray) |
| 1117 |
|| (typeof Uint16Array === 'function' && value instanceof Uint16Array) |
| 1118 |
|| (typeof Uint32Array === 'function' && value instanceof Uint32Array) |
| 1119 |
|| (typeof Int8Array === 'function' && value instanceof Int8Array) |
| 1120 |
|| (typeof Int16Array === 'function' && value instanceof Int16Array) |
| 1121 |
|| (typeof Int32Array === 'function' && value instanceof Int32Array) |
| 1122 |
|| (typeof Float32Array === 'function' && value instanceof Float32Array) |
| 1123 |
|| (typeof Float64Array === 'function' && value instanceof Float64Array) |
| 1124 |
|| (typeof BigUint64Array === 'function' && value instanceof BigUint64Array) |
| 1125 |
|| (typeof BigInt64Array === 'function' && value instanceof BigInt64Array); |
| 1126 |
} |
| 1127 |
|
| 1128 |
function compareArrayLikeEquality(a, b, cache) { |
| 1129 |
if (a.length !== b.length) return NOT_EQUAL; |
| 1130 |
for (var i = 0; i < a.length; i++) { |
| 1131 |
if (compareEquality(a[i], b[i], cache) === NOT_EQUAL) { |
| 1132 |
return NOT_EQUAL; |
| 1133 |
} |
| 1134 |
} |
| 1135 |
return EQUAL; |
| 1136 |
} |
| 1137 |
|
| 1138 |
function isStructurallyEquatable(value) { |
| 1139 |
return !(typeof Promise === 'function' && value instanceof Promise // only comparable by reference |
| 1140 |
|| typeof WeakMap === 'function' && value instanceof WeakMap // only comparable by reference |
| 1141 |
|| typeof WeakSet === 'function' && value instanceof WeakSet // only comparable by reference |
| 1142 |
|| typeof Map === 'function' && value instanceof Map // comparable via @@iterator |
| 1143 |
|| typeof Set === 'function' && value instanceof Set); // comparable via @@iterator |
| 1144 |
} |
| 1145 |
|
| 1146 |
function compareStructuralEquality(a, b, cache) { |
| 1147 |
var aKeys = []; |
| 1148 |
for (var key in a) aKeys.push(key); |
| 1149 |
|
| 1150 |
var bKeys = []; |
| 1151 |
for (var key in b) bKeys.push(key); |
| 1152 |
|
| 1153 |
if (aKeys.length !== bKeys.length) { |
| 1154 |
return NOT_EQUAL; |
| 1155 |
} |
| 1156 |
|
| 1157 |
aKeys.sort(); |
| 1158 |
bKeys.sort(); |
| 1159 |
|
| 1160 |
for (var i = 0; i < aKeys.length; i++) { |
| 1161 |
var aKey = aKeys[i]; |
| 1162 |
var bKey = bKeys[i]; |
| 1163 |
if (compareEquality(aKey, bKey, cache) === NOT_EQUAL) { |
| 1164 |
return NOT_EQUAL; |
| 1165 |
} |
| 1166 |
if (compareEquality(a[aKey], b[bKey], cache) === NOT_EQUAL) { |
| 1167 |
return NOT_EQUAL; |
| 1168 |
} |
| 1169 |
} |
| 1170 |
|
| 1171 |
return compareIf(a, b, isIterableEquatable, compareIterableEquality, cache) |
| 1172 |
|| EQUAL; |
| 1173 |
} |
| 1174 |
|
| 1175 |
function isIterableEquatable(value) { |
| 1176 |
return typeof Symbol === 'function' |
| 1177 |
&& typeof value[Symbol.iterator] === 'function'; |
| 1178 |
} |
| 1179 |
|
| 1180 |
function compareIteratorEquality(a, b, cache) { |
| 1181 |
if (typeof Map === 'function' && a instanceof Map && b instanceof Map || |
| 1182 |
typeof Set === 'function' && a instanceof Set && b instanceof Set) { |
| 1183 |
if (a.size !== b.size) return NOT_EQUAL; // exit early if we detect a difference in size |
| 1184 |
} |
| 1185 |
|
| 1186 |
var ar, br; |
| 1187 |
while (true) { |
| 1188 |
ar = a.next(); |
| 1189 |
br = b.next(); |
| 1190 |
if (ar.done) { |
| 1191 |
if (br.done) return EQUAL; |
| 1192 |
if (b.return) b.return(); |
| 1193 |
return NOT_EQUAL; |
| 1194 |
} |
| 1195 |
if (br.done) { |
| 1196 |
if (a.return) a.return(); |
| 1197 |
return NOT_EQUAL; |
| 1198 |
} |
| 1199 |
if (compareEquality(ar.value, br.value, cache) === NOT_EQUAL) { |
| 1200 |
if (a.return) a.return(); |
| 1201 |
if (b.return) b.return(); |
| 1202 |
return NOT_EQUAL; |
| 1203 |
} |
| 1204 |
} |
| 1205 |
} |
| 1206 |
|
| 1207 |
function compareIterableEquality(a, b, cache) { |
| 1208 |
return compareIteratorEquality(a[Symbol.iterator](), b[Symbol.iterator](), cache); |
| 1209 |
} |
| 1210 |
|
| 1211 |
function cacheComparison(a, b, compare, cache) { |
| 1212 |
var result = compare(a, b, cache); |
| 1213 |
if (cache && (result === EQUAL || result === NOT_EQUAL)) { |
| 1214 |
setCache(cache, a, b, /** @type {EQUAL | NOT_EQUAL} */(result)); |
| 1215 |
} |
| 1216 |
return result; |
| 1217 |
} |
| 1218 |
|
| 1219 |
function fail() { |
| 1220 |
return NOT_EQUAL; |
| 1221 |
} |
| 1222 |
|
| 1223 |
function setCache(cache, left, right, result) { |
| 1224 |
var otherCache; |
| 1225 |
|
| 1226 |
otherCache = cache.get(left); |
| 1227 |
if (!otherCache) cache.set(left, otherCache = new Map()); |
| 1228 |
otherCache.set(right, result); |
| 1229 |
|
| 1230 |
otherCache = cache.get(right); |
| 1231 |
if (!otherCache) cache.set(right, otherCache = new Map()); |
| 1232 |
otherCache.set(left, result); |
| 1233 |
} |
| 1234 |
|
| 1235 |
function getCache(cache, left, right) { |
| 1236 |
var otherCache; |
| 1237 |
var result; |
| 1238 |
|
| 1239 |
otherCache = cache.get(left); |
| 1240 |
result = otherCache && otherCache.get(right); |
| 1241 |
if (result) return result; |
| 1242 |
|
| 1243 |
otherCache = cache.get(right); |
| 1244 |
result = otherCache && otherCache.get(left); |
| 1245 |
if (result) return result; |
| 1246 |
|
| 1247 |
return UNKNOWN; |
| 1248 |
} |
| 1249 |
|
| 1250 |
return deepEqual; |
| 1251 |
})(); |
| 1252 |
|
| 1253 |
// file: detachArrayBuffer.js |
| 1254 |
// Copyright (C) 2016 the V8 project authors. All rights reserved. |
| 1255 |
// This code is governed by the BSD license found in the LICENSE file. |
| 1256 |
/*--- |
| 1257 |
description: | |
| 1258 |
A function used in the process of asserting correctness of TypedArray objects. |
| 1259 |
|
| 1260 |
$262.detachArrayBuffer is defined by a host. |
| 1261 |
defines: [$DETACHBUFFER] |
| 1262 |
---*/ |
| 1263 |
|
| 1264 |
function $DETACHBUFFER(buffer) { |
| 1265 |
if (!$262 || typeof $262.detachArrayBuffer !== "function") { |
| 1266 |
throw new Test262Error("No method available to detach an ArrayBuffer"); |
| 1267 |
} |
| 1268 |
$262.detachArrayBuffer(buffer); |
| 1269 |
} |
| 1270 |
|
| 1271 |
// file: fnGlobalObject.js |
| 1272 |
// Copyright (C) 2017 Ecma International. All rights reserved. |
| 1273 |
// This code is governed by the BSD license found in the LICENSE file. |
| 1274 |
/*--- |
| 1275 |
description: | |
| 1276 |
Produce a reliable global object |
| 1277 |
defines: [fnGlobalObject] |
| 1278 |
---*/ |
| 1279 |
|
| 1280 |
var __globalObject = Function("return this;")(); |
| 1281 |
function fnGlobalObject() { |
| 1282 |
return __globalObject; |
| 1283 |
} |
| 1284 |
|
| 1285 |
// file: isConstructor.js |
| 1286 |
// Copyright (C) 2017 André Bargull. All rights reserved. |
| 1287 |
// This code is governed by the BSD license found in the LICENSE file. |
| 1288 |
|
| 1289 |
/*--- |
| 1290 |
description: | |
| 1291 |
Test if a given function is a constructor function. |
| 1292 |
defines: [isConstructor] |
| 1293 |
features: [Reflect.construct] |
| 1294 |
---*/ |
| 1295 |
|
| 1296 |
function isConstructor(f) { |
| 1297 |
if (typeof f !== "function") { |
| 1298 |
throw new Test262Error("isConstructor invoked with a non-function value"); |
| 1299 |
} |
| 1300 |
|
| 1301 |
try { |
| 1302 |
Reflect.construct(function(){}, [], f); |
| 1303 |
} catch (e) { |
| 1304 |
return false; |
| 1305 |
} |
| 1306 |
return true; |
| 1307 |
} |
| 1308 |
|
| 1309 |
// file: nans.js |
| 1310 |
// Copyright (C) 2016 the V8 project authors. All rights reserved. |
| 1311 |
// This code is governed by the BSD license found in the LICENSE file. |
| 1312 |
/*--- |
| 1313 |
description: | |
| 1314 |
A collection of NaN values produced from expressions that have been observed |
| 1315 |
to create distinct bit representations on various platforms. These provide a |
| 1316 |
weak basis for assertions regarding the consistent canonicalization of NaN |
| 1317 |
values in Array buffers. |
| 1318 |
defines: [NaNs] |
| 1319 |
---*/ |
| 1320 |
|
| 1321 |
var NaNs = [ |
| 1322 |
NaN, |
| 1323 |
Number.NaN, |
| 1324 |
NaN * 0, |
| 1325 |
0/0, |
| 1326 |
Infinity/Infinity, |
| 1327 |
-(0/0), |
| 1328 |
Math.pow(-1, 0.5), |
| 1329 |
-Math.pow(-1, 0.5), |
| 1330 |
Number("Not-a-Number"), |
| 1331 |
]; |
| 1332 |
|
| 1333 |
// file: nativeFunctionMatcher.js |
| 1334 |
// Copyright (C) 2016 Michael Ficarra. All rights reserved. |
| 1335 |
// This code is governed by the BSD license found in the LICENSE file. |
| 1336 |
/*--- |
| 1337 |
description: Assert _NativeFunction_ Syntax |
| 1338 |
info: | |
| 1339 |
NativeFunction : |
| 1340 |
function _NativeFunctionAccessor_ opt _IdentifierName_ opt ( _FormalParameters_ ) { [ native code ] } |
| 1341 |
NativeFunctionAccessor : |
| 1342 |
get |
| 1343 |
set |
| 1344 |
defines: |
| 1345 |
- assertToStringOrNativeFunction |
| 1346 |
- assertNativeFunction |
| 1347 |
- validateNativeFunctionSource |
| 1348 |
---*/ |
| 1349 |
|
| 1350 |
const validateNativeFunctionSource = function(source) { |
| 1351 |
// These regexes should be kept up to date with Unicode using `regexpu-core`. |
| 1352 |
// `/\p{ID_Start}/u` |
| 1353 |
const UnicodeIDStart = /(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDEC0-\uDEEB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/; |
| 1354 |
// `/\p{ID_Continue}/u` |
| 1355 |
const UnicodeIDContinue = /(?:[0-9A-Z_a-z\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u08D3-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1ABF\u1AC0\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA827\uA82C\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD27\uDD30-\uDD39\uDE80-\uDEA9\uDEAB\uDEAC\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF50\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD44-\uDD47\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDC9-\uDDCC\uDDCE-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3B-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC5E-\uDC61\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC00-\uDC3A\uDCA0-\uDCE9\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD35\uDD37\uDD38\uDD3B-\uDD43\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE1\uDDE3\uDDE4\uDE00-\uDE3E\uDE47\uDE50-\uDE99\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3\uDFE4\uDFF0\uDFF1]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD00-\uDD2C\uDD30-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]|\uDB40[\uDD00-\uDDEF])/; |
| 1356 |
// `/\p{Space_Separator}/u` |
| 1357 |
const UnicodeSpaceSeparator = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/; |
| 1358 |
|
| 1359 |
const isNewline = (c) => /[\u000A\u000D\u2028\u2029]/.test(c); |
| 1360 |
const isWhitespace = (c) => /[\u0009\u000B\u000C\u0020\u00A0\uFEFF]/.test(c) || UnicodeSpaceSeparator.test(c); |
| 1361 |
|
| 1362 |
let pos = 0; |
| 1363 |
|
| 1364 |
const eatWhitespace = () => { |
| 1365 |
while (pos < source.length) { |
| 1366 |
const c = source[pos]; |
| 1367 |
if (isWhitespace(c) || isNewline(c)) { |
| 1368 |
pos += 1; |
| 1369 |
continue; |
| 1370 |
} |
| 1371 |
|
| 1372 |
if (c === '/') { |
| 1373 |
if (source[pos + 1] === '/') { |
| 1374 |
while (pos < source.length) { |
| 1375 |
if (isNewline(source[pos])) { |
| 1376 |
break; |
| 1377 |
} |
| 1378 |
pos += 1; |
| 1379 |
} |
| 1380 |
continue; |
| 1381 |
} |
| 1382 |
if (source[pos + 1] === '*') { |
| 1383 |
const end = source.indexOf('*/', pos); |
| 1384 |
if (end === -1) { |
| 1385 |
throw new SyntaxError(); |
| 1386 |
} |
| 1387 |
pos = end + '*/'.length; |
| 1388 |
continue; |
| 1389 |
} |
| 1390 |
} |
| 1391 |
|
| 1392 |
break; |
| 1393 |
} |
| 1394 |
}; |
| 1395 |
|
| 1396 |
const getIdentifier = () => { |
| 1397 |
eatWhitespace(); |
| 1398 |
|
| 1399 |
const start = pos; |
| 1400 |
let end = pos; |
| 1401 |
switch (source[end]) { |
| 1402 |
case '_': |
| 1403 |
case '$': |
| 1404 |
end += 1; |
| 1405 |
break; |
| 1406 |
default: |
| 1407 |
if (UnicodeIDStart.test(source[end])) { |
| 1408 |
end += 1; |
| 1409 |
break; |
| 1410 |
} |
| 1411 |
return null; |
| 1412 |
} |
| 1413 |
while (end < source.length) { |
| 1414 |
const c = source[end]; |
| 1415 |
switch (c) { |
| 1416 |
case '_': |
| 1417 |
case '$': |
| 1418 |
end += 1; |
| 1419 |
break; |
| 1420 |
default: |
| 1421 |
if (UnicodeIDContinue.test(c)) { |
| 1422 |
end += 1; |
| 1423 |
break; |
| 1424 |
} |
| 1425 |
return source.slice(start, end); |
| 1426 |
} |
| 1427 |
} |
| 1428 |
return source.slice(start, end); |
| 1429 |
}; |
| 1430 |
|
| 1431 |
const test = (s) => { |
| 1432 |
eatWhitespace(); |
| 1433 |
|
| 1434 |
if (/\w/.test(s)) { |
| 1435 |
return getIdentifier() === s; |
| 1436 |
} |
| 1437 |
return source.slice(pos, pos + s.length) === s; |
| 1438 |
}; |
| 1439 |
|
| 1440 |
const eat = (s) => { |
| 1441 |
if (test(s)) { |
| 1442 |
pos += s.length; |
| 1443 |
return true; |
| 1444 |
} |
| 1445 |
return false; |
| 1446 |
}; |
| 1447 |
|
| 1448 |
const eatIdentifier = () => { |
| 1449 |
const n = getIdentifier(); |
| 1450 |
if (n !== null) { |
| 1451 |
pos += n.length; |
| 1452 |
return true; |
| 1453 |
} |
| 1454 |
return false; |
| 1455 |
}; |
| 1456 |
|
| 1457 |
const expect = (s) => { |
| 1458 |
if (!eat(s)) { |
| 1459 |
throw new SyntaxError(); |
| 1460 |
} |
| 1461 |
}; |
| 1462 |
|
| 1463 |
const eatString = () => { |
| 1464 |
if (source[pos] === '\'' || source[pos] === '"') { |
| 1465 |
const match = source[pos]; |
| 1466 |
pos += 1; |
| 1467 |
while (pos < source.length) { |
| 1468 |
if (source[pos] === match && source[pos - 1] !== '\\') { |
| 1469 |
return; |
| 1470 |
} |
| 1471 |
if (isNewline(source[pos])) { |
| 1472 |
throw new SyntaxError(); |
| 1473 |
} |
| 1474 |
pos += 1; |
| 1475 |
} |
| 1476 |
throw new SyntaxError(); |
| 1477 |
} |
| 1478 |
}; |
| 1479 |
|
| 1480 |
// "Stumble" through source text until matching character is found. |
| 1481 |
// Assumes ECMAScript syntax keeps `[]` and `()` balanced. |
| 1482 |
const stumbleUntil = (c) => { |
| 1483 |
const match = { |
| 1484 |
']': '[', |
| 1485 |
')': '(', |
| 1486 |
}[c]; |
| 1487 |
let nesting = 1; |
| 1488 |
while (pos < source.length) { |
| 1489 |
eatWhitespace(); |
| 1490 |
eatString(); // Strings may contain unbalanced characters. |
| 1491 |
if (source[pos] === match) { |
| 1492 |
nesting += 1; |
| 1493 |
} else if (source[pos] === c) { |
| 1494 |
nesting -= 1; |
| 1495 |
} |
| 1496 |
pos += 1; |
| 1497 |
if (nesting === 0) { |
| 1498 |
return; |
| 1499 |
} |
| 1500 |
} |
| 1501 |
throw new SyntaxError(); |
| 1502 |
}; |
| 1503 |
|
| 1504 |
// function |
| 1505 |
expect('function'); |
| 1506 |
|
| 1507 |
// NativeFunctionAccessor |
| 1508 |
eat('get') || eat('set'); |
| 1509 |
|
| 1510 |
// PropertyName |
| 1511 |
if (!eatIdentifier() && eat('[')) { |
| 1512 |
stumbleUntil(']'); |
| 1513 |
} |
| 1514 |
|
| 1515 |
// ( FormalParameters ) |
| 1516 |
expect('('); |
| 1517 |
stumbleUntil(')'); |
| 1518 |
|
| 1519 |
// { |
| 1520 |
expect('{'); |
| 1521 |
|
| 1522 |
// [native code] |
| 1523 |
expect('['); |
| 1524 |
expect('native'); |
| 1525 |
expect('code'); |
| 1526 |
expect(']'); |
| 1527 |
|
| 1528 |
// } |
| 1529 |
expect('}'); |
| 1530 |
|
| 1531 |
eatWhitespace(); |
| 1532 |
if (pos !== source.length) { |
| 1533 |
throw new SyntaxError(); |
| 1534 |
} |
| 1535 |
}; |
| 1536 |
|
| 1537 |
const assertToStringOrNativeFunction = function(fn, expected) { |
| 1538 |
const actual = "" + fn; |
| 1539 |
try { |
| 1540 |
assert.sameValue(actual, expected); |
| 1541 |
} catch (unused) { |
| 1542 |
assertNativeFunction(fn, expected); |
| 1543 |
} |
| 1544 |
}; |
| 1545 |
|
| 1546 |
const assertNativeFunction = function(fn, special) { |
| 1547 |
const actual = "" + fn; |
| 1548 |
try { |
| 1549 |
validateNativeFunctionSource(actual); |
| 1550 |
} catch (unused) { |
| 1551 |
throw new Test262Error('Conforms to NativeFunction Syntax: ' + JSON.stringify(actual) + (special ? ' (' + special + ')' : '')); |
| 1552 |
} |
| 1553 |
}; |
| 1554 |
|
| 1555 |
// file: promiseHelper.js |
| 1556 |
// Copyright (C) 2017 Ecma International. All rights reserved. |
| 1557 |
// This code is governed by the BSD license found in the LICENSE file. |
| 1558 |
/*--- |
| 1559 |
description: | |
| 1560 |
Check that an array contains a numeric sequence starting at 1 |
| 1561 |
and incrementing by 1 for each entry in the array. Used by |
| 1562 |
Promise tests to assert the order of execution in deep Promise |
| 1563 |
resolution pipelines. |
| 1564 |
defines: [checkSequence, checkSettledPromises] |
| 1565 |
---*/ |
| 1566 |
|
| 1567 |
function checkSequence(arr, message) { |
| 1568 |
arr.forEach(function(e, i) { |
| 1569 |
if (e !== (i+1)) { |
| 1570 |
throw new Test262Error((message ? message : "Steps in unexpected sequence:") + |
| 1571 |
" '" + arr.join(',') + "'"); |
| 1572 |
} |
| 1573 |
}); |
| 1574 |
|
| 1575 |
return true; |
| 1576 |
} |
| 1577 |
|
| 1578 |
function checkSettledPromises(settleds, expected, message) { |
| 1579 |
const prefix = message ? `${message}: ` : ''; |
| 1580 |
|
| 1581 |
assert.sameValue(Array.isArray(settleds), true, `${prefix}Settled values is an array`); |
| 1582 |
|
| 1583 |
assert.sameValue( |
| 1584 |
settleds.length, |
| 1585 |
expected.length, |
| 1586 |
`${prefix}The settled values has a different length than expected` |
| 1587 |
); |
| 1588 |
|
| 1589 |
settleds.forEach((settled, i) => { |
| 1590 |
assert.sameValue( |
| 1591 |
Object.prototype.hasOwnProperty.call(settled, 'status'), |
| 1592 |
true, |
| 1593 |
`${prefix}The settled value has a property status` |
| 1594 |
); |
| 1595 |
|
| 1596 |
assert.sameValue(settled.status, expected[i].status, `${prefix}status for item ${i}`); |
| 1597 |
|
| 1598 |
if (settled.status === 'fulfilled') { |
| 1599 |
assert.sameValue( |
| 1600 |
Object.prototype.hasOwnProperty.call(settled, 'value'), |
| 1601 |
true, |
| 1602 |
`${prefix}The fulfilled promise has a property named value` |
| 1603 |
); |
| 1604 |
|
| 1605 |
assert.sameValue( |
| 1606 |
Object.prototype.hasOwnProperty.call(settled, 'reason'), |
| 1607 |
false, |
| 1608 |
`${prefix}The fulfilled promise has no property named reason` |
| 1609 |
); |
| 1610 |
|
| 1611 |
assert.sameValue(settled.value, expected[i].value, `${prefix}value for item ${i}`); |
| 1612 |
} else { |
| 1613 |
assert.sameValue(settled.status, 'rejected', `${prefix}Valid statuses are only fulfilled or rejected`); |
| 1614 |
|
| 1615 |
assert.sameValue( |
| 1616 |
Object.prototype.hasOwnProperty.call(settled, 'value'), |
| 1617 |
false, |
| 1618 |
`${prefix}The fulfilled promise has no property named value` |
| 1619 |
); |
| 1620 |
|
| 1621 |
assert.sameValue( |
| 1622 |
Object.prototype.hasOwnProperty.call(settled, 'reason'), |
| 1623 |
true, |
| 1624 |
`${prefix}The fulfilled promise has a property named reason` |
| 1625 |
); |
| 1626 |
|
| 1627 |
assert.sameValue(settled.reason, expected[i].reason, `${prefix}Reason value for item ${i}`); |
| 1628 |
} |
| 1629 |
}); |
| 1630 |
} |
| 1631 |
|
| 1632 |
// file: proxyTrapsHelper.js |
| 1633 |
// Copyright (C) 2016 Jordan Harband. All rights reserved. |
| 1634 |
// This code is governed by the BSD license found in the LICENSE file. |
| 1635 |
/*--- |
| 1636 |
description: | |
| 1637 |
Used to assert the correctness of object behavior in the presence |
| 1638 |
and context of Proxy objects. |
| 1639 |
defines: [allowProxyTraps] |
| 1640 |
---*/ |
| 1641 |
|
| 1642 |
function allowProxyTraps(overrides) { |
| 1643 |
function throwTest262Error(msg) { |
| 1644 |
return function () { throw new Test262Error(msg); }; |
| 1645 |
} |
| 1646 |
if (!overrides) { overrides = {}; } |
| 1647 |
return { |
| 1648 |
getPrototypeOf: overrides.getPrototypeOf || throwTest262Error('[[GetPrototypeOf]] trap called'), |
| 1649 |
setPrototypeOf: overrides.setPrototypeOf || throwTest262Error('[[SetPrototypeOf]] trap called'), |
| 1650 |
isExtensible: overrides.isExtensible || throwTest262Error('[[IsExtensible]] trap called'), |
| 1651 |
preventExtensions: overrides.preventExtensions || throwTest262Error('[[PreventExtensions]] trap called'), |
| 1652 |
getOwnPropertyDescriptor: overrides.getOwnPropertyDescriptor || throwTest262Error('[[GetOwnProperty]] trap called'), |
| 1653 |
has: overrides.has || throwTest262Error('[[HasProperty]] trap called'), |
| 1654 |
get: overrides.get || throwTest262Error('[[Get]] trap called'), |
| 1655 |
set: overrides.set || throwTest262Error('[[Set]] trap called'), |
| 1656 |
deleteProperty: overrides.deleteProperty || throwTest262Error('[[Delete]] trap called'), |
| 1657 |
defineProperty: overrides.defineProperty || throwTest262Error('[[DefineOwnProperty]] trap called'), |
| 1658 |
enumerate: throwTest262Error('[[Enumerate]] trap called: this trap has been removed'), |
| 1659 |
ownKeys: overrides.ownKeys || throwTest262Error('[[OwnPropertyKeys]] trap called'), |
| 1660 |
apply: overrides.apply || throwTest262Error('[[Call]] trap called'), |
| 1661 |
construct: overrides.construct || throwTest262Error('[[Construct]] trap called') |
| 1662 |
}; |
| 1663 |
} |
| 1664 |
|
| 1665 |
// file: tcoHelper.js |
| 1666 |
// Copyright (C) 2016 the V8 project authors. All rights reserved. |
| 1667 |
// This code is governed by the BSD license found in the LICENSE file. |
| 1668 |
/*--- |
| 1669 |
description: | |
| 1670 |
This defines the number of consecutive recursive function calls that must be |
| 1671 |
made in order to prove that stack frames are properly destroyed according to |
| 1672 |
ES2015 tail call optimization semantics. |
| 1673 |
defines: [$MAX_ITERATIONS] |
| 1674 |
---*/ |
| 1675 |
|
| 1676 |
|
| 1677 |
|
| 1678 |
|
| 1679 |
var $MAX_ITERATIONS = 100000; |
| 1680 |
|
| 1681 |
// file: testTypedArray.js |
| 1682 |
// Copyright (C) 2015 André Bargull. All rights reserved. |
| 1683 |
// This code is governed by the BSD license found in the LICENSE file. |
| 1684 |
/*--- |
| 1685 |
description: | |
| 1686 |
Collection of functions used to assert the correctness of TypedArray objects. |
| 1687 |
defines: |
| 1688 |
- floatArrayConstructors |
| 1689 |
- nonClampedIntArrayConstructors |
| 1690 |
- intArrayConstructors |
| 1691 |
- typedArrayConstructors |
| 1692 |
- TypedArray |
| 1693 |
- testWithTypedArrayConstructors |
| 1694 |
- nonAtomicsFriendlyTypedArrayConstructors |
| 1695 |
- testWithAtomicsFriendlyTypedArrayConstructors |
| 1696 |
- testWithNonAtomicsFriendlyTypedArrayConstructors |
| 1697 |
- testTypedArrayConversions |
| 1698 |
---*/ |
| 1699 |
|
| 1700 |
var floatArrayConstructors = [ |
| 1701 |
Float64Array, |
| 1702 |
Float32Array |
| 1703 |
]; |
| 1704 |
|
| 1705 |
var nonClampedIntArrayConstructors = [ |
| 1706 |
Int32Array, |
| 1707 |
Int16Array, |
| 1708 |
Int8Array, |
| 1709 |
Uint32Array, |
| 1710 |
Uint16Array, |
| 1711 |
Uint8Array |
| 1712 |
]; |
| 1713 |
|
| 1714 |
var intArrayConstructors = nonClampedIntArrayConstructors.concat([Uint8ClampedArray]); |
| 1715 |
|
| 1716 |
// Float16Array is a newer feature |
| 1717 |
// adding it to this list unconditionally would cause implementations lacking it to fail every test which uses it |
| 1718 |
if (typeof Float16Array !== 'undefined') { |
| 1719 |
floatArrayConstructors.push(Float16Array); |
| 1720 |
} |
| 1721 |
|
| 1722 |
/** |
| 1723 |
* Array containing every non-bigint typed array constructor. |
| 1724 |
*/ |
| 1725 |
|
| 1726 |
var typedArrayConstructors = floatArrayConstructors.concat(intArrayConstructors); |
| 1727 |
|
| 1728 |
/** |
| 1729 |
* The %TypedArray% intrinsic constructor function. |
| 1730 |
*/ |
| 1731 |
var TypedArray = Object.getPrototypeOf(Int8Array); |
| 1732 |
|
| 1733 |
/** |
| 1734 |
* Callback for testing a typed array constructor. |
| 1735 |
* |
| 1736 |
* @callback typedArrayConstructorCallback |
| 1737 |
* @param {Function} Constructor the constructor object to test with. |
| 1738 |
*/ |
| 1739 |
|
| 1740 |
/** |
| 1741 |
* Calls the provided function for every typed array constructor. |
| 1742 |
* |
| 1743 |
* @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor. |
| 1744 |
* @param {Array} selected - An optional Array with filtered typed arrays |
| 1745 |
*/ |
| 1746 |
function testWithTypedArrayConstructors(f, selected) { |
| 1747 |
var constructors = selected || typedArrayConstructors; |
| 1748 |
for (var i = 0; i < constructors.length; ++i) { |
| 1749 |
var constructor = constructors[i]; |
| 1750 |
try { |
| 1751 |
f(constructor); |
| 1752 |
} catch (e) { |
| 1753 |
e.message += " (Testing with " + constructor.name + ".)"; |
| 1754 |
throw e; |
| 1755 |
} |
| 1756 |
} |
| 1757 |
} |
| 1758 |
|
| 1759 |
var nonAtomicsFriendlyTypedArrayConstructors = floatArrayConstructors.concat([Uint8ClampedArray]); |
| 1760 |
/** |
| 1761 |
* Calls the provided function for every non-"Atomics Friendly" typed array constructor. |
| 1762 |
* |
| 1763 |
* @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor. |
| 1764 |
* @param {Array} selected - An optional Array with filtered typed arrays |
| 1765 |
*/ |
| 1766 |
function testWithNonAtomicsFriendlyTypedArrayConstructors(f) { |
| 1767 |
testWithTypedArrayConstructors(f, nonAtomicsFriendlyTypedArrayConstructors); |
| 1768 |
} |
| 1769 |
|
| 1770 |
/** |
| 1771 |
* Calls the provided function for every "Atomics Friendly" typed array constructor. |
| 1772 |
* |
| 1773 |
* @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor. |
| 1774 |
* @param {Array} selected - An optional Array with filtered typed arrays |
| 1775 |
*/ |
| 1776 |
function testWithAtomicsFriendlyTypedArrayConstructors(f) { |
| 1777 |
testWithTypedArrayConstructors(f, [ |
| 1778 |
Int32Array, |
| 1779 |
Int16Array, |
| 1780 |
Int8Array, |
| 1781 |
Uint32Array, |
| 1782 |
Uint16Array, |
| 1783 |
Uint8Array, |
| 1784 |
]); |
| 1785 |
} |
| 1786 |
|
| 1787 |
/** |
| 1788 |
* Helper for conversion operations on TypedArrays, the expected values |
| 1789 |
* properties are indexed in order to match the respective value for each |
| 1790 |
* TypedArray constructor |
| 1791 |
* @param {Function} fn - the function to call for each constructor and value. |
| 1792 |
* will be called with the constructor, value, expected |
| 1793 |
* value, and a initial value that can be used to avoid |
| 1794 |
* a false positive with an equivalent expected value. |
| 1795 |
*/ |
| 1796 |
function testTypedArrayConversions(byteConversionValues, fn) { |
| 1797 |
var values = byteConversionValues.values; |
| 1798 |
var expected = byteConversionValues.expected; |
| 1799 |
|
| 1800 |
testWithTypedArrayConstructors(function(TA) { |
| 1801 |
var name = TA.name.slice(0, -5); |
| 1802 |
|
| 1803 |
return values.forEach(function(value, index) { |
| 1804 |
var exp = expected[name][index]; |
| 1805 |
var initial = 0; |
| 1806 |
if (exp === 0) { |
| 1807 |
initial = 1; |
| 1808 |
} |
| 1809 |
fn(TA, value, exp, initial); |
| 1810 |
}); |
| 1811 |
}); |
| 1812 |
} |
| 1813 |
|
| 1814 |
/** |
| 1815 |
* Checks if the given argument is one of the float-based TypedArray constructors. |
| 1816 |
* |
| 1817 |
* @param {constructor} ctor - the value to check |
| 1818 |
* @returns {boolean} |
| 1819 |
*/ |
| 1820 |
function isFloatTypedArrayConstructor(arg) { |
| 1821 |
return floatArrayConstructors.indexOf(arg) !== -1; |
| 1822 |
} |
| 1823 |
|
| 1824 |
/** |
| 1825 |
* Determines the precision of the given float-based TypedArray constructor. |
| 1826 |
* |
| 1827 |
* @param {constructor} ctor - the value to check |
| 1828 |
* @returns {string} "half", "single", or "double" for Float16Array, Float32Array, and Float64Array respectively. |
| 1829 |
*/ |
| 1830 |
function floatTypedArrayConstructorPrecision(FA) { |
| 1831 |
if (typeof Float16Array !== "undefined" && FA === Float16Array) { |
| 1832 |
return "half"; |
| 1833 |
} else if (FA === Float32Array) { |
| 1834 |
return "single"; |
| 1835 |
} else if (FA === Float64Array) { |
| 1836 |
return "double"; |
| 1837 |
} else { |
| 1838 |
throw new Error("Malformed test - floatTypedArrayConstructorPrecision called with non-float TypedArray"); |
| 1839 |
} |
| 1840 |
} |
| 1841 |
|
| 1842 |
// file: wellKnownIntrinsicObjects.js |
| 1843 |
// Copyright (C) 2018 the V8 project authors. All rights reserved. |
| 1844 |
// This code is governed by the BSD license found in the LICENSE file. |
| 1845 |
/*--- |
| 1846 |
description: | |
| 1847 |
An Array of all representable Well-Known Intrinsic Objects |
| 1848 |
defines: [WellKnownIntrinsicObjects, getWellKnownIntrinsicObject] |
| 1849 |
---*/ |
| 1850 |
|
| 1851 |
const WellKnownIntrinsicObjects = [ |
| 1852 |
{ |
| 1853 |
name: '%AggregateError%', |
| 1854 |
source: 'AggregateError', |
| 1855 |
}, |
| 1856 |
{ |
| 1857 |
name: '%Array%', |
| 1858 |
source: 'Array', |
| 1859 |
}, |
| 1860 |
{ |
| 1861 |
name: '%ArrayBuffer%', |
| 1862 |
source: 'ArrayBuffer', |
| 1863 |
}, |
| 1864 |
{ |
| 1865 |
name: '%ArrayIteratorPrototype%', |
| 1866 |
source: 'Object.getPrototypeOf([][Symbol.iterator]())', |
| 1867 |
}, |
| 1868 |
{ |
| 1869 |
// Not currently accessible to ECMAScript user code |
| 1870 |
name: '%AsyncFromSyncIteratorPrototype%', |
| 1871 |
source: '', |
| 1872 |
}, |
| 1873 |
{ |
| 1874 |
name: '%AsyncFunction%', |
| 1875 |
source: '(async function() {}).constructor', |
| 1876 |
}, |
| 1877 |
{ |
| 1878 |
name: '%AsyncGeneratorFunction%', |
| 1879 |
source: '(async function* () {}).constructor', |
| 1880 |
}, |
| 1881 |
{ |
| 1882 |
name: '%AsyncGeneratorPrototype%', |
| 1883 |
source: 'Object.getPrototypeOf(async function* () {}).prototype', |
| 1884 |
}, |
| 1885 |
{ |
| 1886 |
name: '%AsyncIteratorPrototype%', |
| 1887 |
source: '((async function * () {})())[Symbol.asyncIterator]()', |
| 1888 |
}, |
| 1889 |
{ |
| 1890 |
name: '%Atomics%', |
| 1891 |
source: 'Atomics', |
| 1892 |
}, |
| 1893 |
{ |
| 1894 |
name: '%BigInt%', |
| 1895 |
source: 'BigInt', |
| 1896 |
}, |
| 1897 |
{ |
| 1898 |
name: '%BigInt64Array%', |
| 1899 |
source: 'BigInt64Array', |
| 1900 |
}, |
| 1901 |
{ |
| 1902 |
name: '%BigUint64Array%', |
| 1903 |
source: 'BigUint64Array', |
| 1904 |
}, |
| 1905 |
{ |
| 1906 |
name: '%Boolean%', |
| 1907 |
source: 'Boolean', |
| 1908 |
}, |
| 1909 |
{ |
| 1910 |
name: '%DataView%', |
| 1911 |
source: 'DataView', |
| 1912 |
}, |
| 1913 |
{ |
| 1914 |
name: '%Date%', |
| 1915 |
source: 'Date', |
| 1916 |
}, |
| 1917 |
{ |
| 1918 |
name: '%decodeURI%', |
| 1919 |
source: 'decodeURI', |
| 1920 |
}, |
| 1921 |
{ |
| 1922 |
name: '%decodeURIComponent%', |
| 1923 |
source: 'decodeURIComponent', |
| 1924 |
}, |
| 1925 |
{ |
| 1926 |
name: '%encodeURI%', |
| 1927 |
source: 'encodeURI', |
| 1928 |
}, |
| 1929 |
{ |
| 1930 |
name: '%encodeURIComponent%', |
| 1931 |
source: 'encodeURIComponent', |
| 1932 |
}, |
| 1933 |
{ |
| 1934 |
name: '%Error%', |
| 1935 |
source: 'Error', |
| 1936 |
}, |
| 1937 |
{ |
| 1938 |
name: '%eval%', |
| 1939 |
source: 'eval', |
| 1940 |
}, |
| 1941 |
{ |
| 1942 |
name: '%EvalError%', |
| 1943 |
source: 'EvalError', |
| 1944 |
}, |
| 1945 |
{ |
| 1946 |
name: '%FinalizationRegistry%', |
| 1947 |
source: 'FinalizationRegistry', |
| 1948 |
}, |
| 1949 |
{ |
| 1950 |
name: '%Float32Array%', |
| 1951 |
source: 'Float32Array', |
| 1952 |
}, |
| 1953 |
{ |
| 1954 |
name: '%Float64Array%', |
| 1955 |
source: 'Float64Array', |
| 1956 |
}, |
| 1957 |
{ |
| 1958 |
// Not currently accessible to ECMAScript user code |
| 1959 |
name: '%ForInIteratorPrototype%', |
| 1960 |
source: '', |
| 1961 |
}, |
| 1962 |
{ |
| 1963 |
name: '%Function%', |
| 1964 |
source: 'Function', |
| 1965 |
}, |
| 1966 |
{ |
| 1967 |
name: '%GeneratorFunction%', |
| 1968 |
source: '(function* () {}).constructor', |
| 1969 |
}, |
| 1970 |
{ |
| 1971 |
name: '%GeneratorPrototype%', |
| 1972 |
source: 'Object.getPrototypeOf(function * () {}).prototype', |
| 1973 |
}, |
| 1974 |
{ |
| 1975 |
name: '%Int8Array%', |
| 1976 |
source: 'Int8Array', |
| 1977 |
}, |
| 1978 |
{ |
| 1979 |
name: '%Int16Array%', |
| 1980 |
source: 'Int16Array', |
| 1981 |
}, |
| 1982 |
{ |
| 1983 |
name: '%Int32Array%', |
| 1984 |
source: 'Int32Array', |
| 1985 |
}, |
| 1986 |
{ |
| 1987 |
name: '%isFinite%', |
| 1988 |
source: 'isFinite', |
| 1989 |
}, |
| 1990 |
{ |
| 1991 |
name: '%isNaN%', |
| 1992 |
source: 'isNaN', |
| 1993 |
}, |
| 1994 |
{ |
| 1995 |
name: '%Iterator%', |
| 1996 |
source: 'typeof Iterator !== "undefined" ? Iterator : Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())).constructor', |
| 1997 |
}, |
| 1998 |
{ |
| 1999 |
name: '%IteratorHelperPrototype%', |
| 2000 |
source: 'Object.getPrototypeOf(Iterator.from([]).drop(0))', |
| 2001 |
}, |
| 2002 |
{ |
| 2003 |
name: '%JSON%', |
| 2004 |
source: 'JSON', |
| 2005 |
}, |
| 2006 |
{ |
| 2007 |
name: '%Map%', |
| 2008 |
source: 'Map', |
| 2009 |
}, |
| 2010 |
{ |
| 2011 |
name: '%MapIteratorPrototype%', |
| 2012 |
source: 'Object.getPrototypeOf(new Map()[Symbol.iterator]())', |
| 2013 |
}, |
| 2014 |
{ |
| 2015 |
name: '%Math%', |
| 2016 |
source: 'Math', |
| 2017 |
}, |
| 2018 |
{ |
| 2019 |
name: '%Number%', |
| 2020 |
source: 'Number', |
| 2021 |
}, |
| 2022 |
{ |
| 2023 |
name: '%Object%', |
| 2024 |
source: 'Object', |
| 2025 |
}, |
| 2026 |
{ |
| 2027 |
name: '%parseFloat%', |
| 2028 |
source: 'parseFloat', |
| 2029 |
}, |
| 2030 |
{ |
| 2031 |
name: '%parseInt%', |
| 2032 |
source: 'parseInt', |
| 2033 |
}, |
| 2034 |
{ |
| 2035 |
name: '%Promise%', |
| 2036 |
source: 'Promise', |
| 2037 |
}, |
| 2038 |
{ |
| 2039 |
name: '%Proxy%', |
| 2040 |
source: 'Proxy', |
| 2041 |
}, |
| 2042 |
{ |
| 2043 |
name: '%RangeError%', |
| 2044 |
source: 'RangeError', |
| 2045 |
}, |
| 2046 |
{ |
| 2047 |
name: '%ReferenceError%', |
| 2048 |
source: 'ReferenceError', |
| 2049 |
}, |
| 2050 |
{ |
| 2051 |
name: '%Reflect%', |
| 2052 |
source: 'Reflect', |
| 2053 |
}, |
| 2054 |
{ |
| 2055 |
name: '%RegExp%', |
| 2056 |
source: 'RegExp', |
| 2057 |
}, |
| 2058 |
{ |
| 2059 |
name: '%RegExpStringIteratorPrototype%', |
| 2060 |
source: 'RegExp.prototype[Symbol.matchAll]("")', |
| 2061 |
}, |
| 2062 |
{ |
| 2063 |
name: '%Set%', |
| 2064 |
source: 'Set', |
| 2065 |
}, |
| 2066 |
{ |
| 2067 |
name: '%SetIteratorPrototype%', |
| 2068 |
source: 'Object.getPrototypeOf(new Set()[Symbol.iterator]())', |
| 2069 |
}, |
| 2070 |
{ |
| 2071 |
name: '%SharedArrayBuffer%', |
| 2072 |
source: 'SharedArrayBuffer', |
| 2073 |
}, |
| 2074 |
{ |
| 2075 |
name: '%String%', |
| 2076 |
source: 'String', |
| 2077 |
}, |
| 2078 |
{ |
| 2079 |
name: '%StringIteratorPrototype%', |
| 2080 |
source: 'Object.getPrototypeOf(new String()[Symbol.iterator]())', |
| 2081 |
}, |
| 2082 |
{ |
| 2083 |
name: '%Symbol%', |
| 2084 |
source: 'Symbol', |
| 2085 |
}, |
| 2086 |
{ |
| 2087 |
name: '%SyntaxError%', |
| 2088 |
source: 'SyntaxError', |
| 2089 |
}, |
| 2090 |
{ |
| 2091 |
name: '%ThrowTypeError%', |
| 2092 |
source: '(function() { "use strict"; return Object.getOwnPropertyDescriptor(arguments, "callee").get })()', |
| 2093 |
}, |
| 2094 |
{ |
| 2095 |
name: '%TypedArray%', |
| 2096 |
source: 'Object.getPrototypeOf(Uint8Array)', |
| 2097 |
}, |
| 2098 |
{ |
| 2099 |
name: '%TypeError%', |
| 2100 |
source: 'TypeError', |
| 2101 |
}, |
| 2102 |
{ |
| 2103 |
name: '%Uint8Array%', |
| 2104 |
source: 'Uint8Array', |
| 2105 |
}, |
| 2106 |
{ |
| 2107 |
name: '%Uint8ClampedArray%', |
| 2108 |
source: 'Uint8ClampedArray', |
| 2109 |
}, |
| 2110 |
{ |
| 2111 |
name: '%Uint16Array%', |
| 2112 |
source: 'Uint16Array', |
| 2113 |
}, |
| 2114 |
{ |
| 2115 |
name: '%Uint32Array%', |
| 2116 |
source: 'Uint32Array', |
| 2117 |
}, |
| 2118 |
{ |
| 2119 |
name: '%URIError%', |
| 2120 |
source: 'URIError', |
| 2121 |
}, |
| 2122 |
{ |
| 2123 |
name: '%WeakMap%', |
| 2124 |
source: 'WeakMap', |
| 2125 |
}, |
| 2126 |
{ |
| 2127 |
name: '%WeakRef%', |
| 2128 |
source: 'WeakRef', |
| 2129 |
}, |
| 2130 |
{ |
| 2131 |
name: '%WeakSet%', |
| 2132 |
source: 'WeakSet', |
| 2133 |
}, |
| 2134 |
{ |
| 2135 |
name: '%WrapForValidIteratorPrototype%', |
| 2136 |
source: 'Object.getPrototypeOf(Iterator.from({ [Symbol.iterator](){ return {}; } }))', |
| 2137 |
}, |
| 2138 |
]; |
| 2139 |
|
| 2140 |
WellKnownIntrinsicObjects.forEach((wkio) => { |
| 2141 |
var actual; |
| 2142 |
|
| 2143 |
try { |
| 2144 |
actual = new Function("return " + wkio.source)(); |
| 2145 |
} catch (exception) { |
| 2146 |
// Nothing to do here. |
| 2147 |
} |
| 2148 |
|
| 2149 |
wkio.value = actual; |
| 2150 |
}); |
| 2151 |
|
| 2152 |
/** |
| 2153 |
* Returns a well-known intrinsic object, if the implementation provides it. |
| 2154 |
* Otherwise, throws. |
| 2155 |
* @param {string} key - the specification's name for the intrinsic, for example |
| 2156 |
* "%Array%" |
| 2157 |
* @returns {object} the well-known intrinsic object. |
| 2158 |
*/ |
| 2159 |
function getWellKnownIntrinsicObject(key) { |
| 2160 |
for (var ix = 0; ix < WellKnownIntrinsicObjects.length; ix++) { |
| 2161 |
if (WellKnownIntrinsicObjects[ix].name === key) { |
| 2162 |
var value = WellKnownIntrinsicObjects[ix].value; |
| 2163 |
if (value !== undefined) |
| 2164 |
return value; |
| 2165 |
throw new Test262Error('this implementation could not obtain ' + key); |
| 2166 |
} |
| 2167 |
} |
| 2168 |
throw new Test262Error('unknown well-known intrinsic ' + key); |
| 2169 |
} |