@nubjs/nub-linux-arm64 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/nub +0 -0
- package/package.json +1 -1
- package/runtime/addons/nub-native.node +0 -0
- package/runtime/node_modules/@js-temporal/polyfill/CHANGELOG.md +453 -0
- package/runtime/node_modules/@js-temporal/polyfill/LICENSE +13 -0
- package/runtime/node_modules/@js-temporal/polyfill/README.md +90 -0
- package/runtime/node_modules/@js-temporal/polyfill/dist/index.cjs +2 -0
- package/runtime/node_modules/@js-temporal/polyfill/dist/index.cjs.map +1 -0
- package/runtime/node_modules/@js-temporal/polyfill/dist/index.esm.js +2 -0
- package/runtime/node_modules/@js-temporal/polyfill/dist/index.esm.js.map +1 -0
- package/runtime/node_modules/@js-temporal/polyfill/dist/index.umd.js +2 -0
- package/runtime/node_modules/@js-temporal/polyfill/dist/index.umd.js.map +1 -0
- package/runtime/node_modules/@js-temporal/polyfill/index.d.cts +1215 -0
- package/runtime/node_modules/@js-temporal/polyfill/index.d.ts +1215 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/assert.ts +8 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/bigintmath.ts +39 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/calendar.ts +2424 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/debug.ts +7 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/duration.ts +438 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/durationformat.d.ts +93 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/ecmascript.ts +4973 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/index.ts +34 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/init.ts +43 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/instant.ts +138 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/internaltypes.d.ts +242 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/intl.ts +758 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/intrinsicclass.ts +162 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/legacydate.ts +17 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/math.ts +96 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/now.ts +48 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/plaindate.ts +212 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/plaindatetime.ts +274 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/plainmonthday.ts +110 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/plaintime.ts +154 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/plainyearmonth.ts +157 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/regex.ts +59 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/slots.ts +341 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/temporal.ts +10 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/timeduration.ts +149 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/zoneddatetime.ts +492 -0
- package/runtime/node_modules/@js-temporal/polyfill/package.json +143 -0
- package/runtime/node_modules/@oxc-parser/binding-linux-x64-gnu/README.md +3 -0
- package/runtime/node_modules/@oxc-parser/binding-linux-x64-gnu/package.json +42 -0
- package/runtime/node_modules/@oxc-parser/binding-linux-x64-gnu/parser.linux-x64-gnu.node +0 -0
- package/runtime/node_modules/@oxc-project/runtime/CHANGELOG.md +88 -0
- package/runtime/node_modules/@oxc-project/runtime/LICENSE +22 -0
- package/runtime/node_modules/@oxc-project/runtime/README.md +5 -0
- package/runtime/node_modules/@oxc-project/runtime/package.json +1066 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/AwaitValue.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecoratedDescriptor.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs.js +236 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2203.js +184 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2203R.js +191 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2301.js +222 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2305.js +133 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2311.js +124 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/arrayLikeToArray.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/arrayWithHoles.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/arrayWithoutHoles.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/assertClassBrand.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/assertThisInitialized.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/asyncGeneratorDelegate.js +24 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js +45 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/asyncToGenerator.js +26 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/callSuper.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/checkInRHS.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/checkPrivateRedeclaration.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classApplyDescriptorDestructureSet.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classApplyDescriptorGet.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classApplyDescriptorSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classCallCheck.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classCheckPrivateStaticAccess.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classCheckPrivateStaticFieldDescriptor.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classExtractFieldDescriptor.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classNameTDZError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldDestructureSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldGet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldGet2.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldInitSpec.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldLooseBase.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldLooseKey.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldSet2.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateGetter.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateMethodGet.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateMethodInitSpec.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateMethodSet.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateSetter.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateFieldDestructureSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateFieldSpecGet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateFieldSpecSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateMethodGet.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateMethodSet.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/construct.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/createClass.js +13 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/createForOfIteratorHelper.js +50 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/createForOfIteratorHelperLoose.js +19 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/createSuper.js +16 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/decorate.js +23 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/decorateMetadata.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/decorateParam.js +11 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/defaults.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/defineAccessor.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/defineEnumerableProperties.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/dispose.js +28 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/AwaitValue.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/OverloadYield.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecoratedDescriptor.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs.js +236 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2203.js +184 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2203R.js +191 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2301.js +222 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2305.js +133 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2311.js +124 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/arrayLikeToArray.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/arrayWithHoles.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/arrayWithoutHoles.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/assertClassBrand.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/assertThisInitialized.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/asyncGeneratorDelegate.js +24 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/asyncIterator.js +45 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/asyncToGenerator.js +26 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/awaitAsyncGenerator.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/callSuper.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/checkInRHS.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/checkPrivateRedeclaration.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classApplyDescriptorDestructureSet.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classApplyDescriptorGet.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classApplyDescriptorSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classCallCheck.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classCheckPrivateStaticAccess.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classCheckPrivateStaticFieldDescriptor.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classExtractFieldDescriptor.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classNameTDZError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldDestructureSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldGet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldGet2.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldInitSpec.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldLooseBase.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldLooseKey.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldSet2.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateGetter.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateMethodGet.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateMethodInitSpec.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateMethodSet.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateSetter.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateFieldDestructureSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateFieldSpecGet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateFieldSpecSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateMethodGet.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateMethodSet.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/construct.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/createClass.js +13 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/createForOfIteratorHelper.js +50 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/createForOfIteratorHelperLoose.js +19 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/createSuper.js +16 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/decorate.js +21 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/decorateMetadata.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/decorateParam.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/defaults.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/defineAccessor.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/defineEnumerableProperties.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/defineProperty.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/dispose.js +28 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/extends.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/get.js +11 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/getPrototypeOf.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/identity.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/importDeferProxy.js +27 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/inherits.js +14 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/inheritsLoose.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/initializerDefineProperty.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/initializerWarningHelper.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/instanceof.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/interopRequireDefault.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/interopRequireWildcard.js +27 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/isNativeFunction.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/isNativeReflectConstruct.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/iterableToArray.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/iterableToArrayLimit.js +28 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/jsx.js +22 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/maybeArrayLike.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/newArrowCheck.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/nonIterableRest.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/nonIterableSpread.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/nullishReceiverError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectDestructuringEmpty.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectSpread.js +14 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectSpread2.js +23 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectWithoutProperties.js +13 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectWithoutPropertiesLoose.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/package.json +3 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/possibleConstructorReturn.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/readOnlyError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/regeneratorRuntime.js +304 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/set.js +22 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/setFunctionName.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/setPrototypeOf.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/skipFirstGeneratorNext.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/slicedToArray.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/superPropBase.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/superPropGet.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/superPropSet.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/taggedTemplateLiteral.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/taggedTemplateLiteralLoose.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/tdz.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/temporalRef.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/temporalUndefined.js +2 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toArray.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toConsumableArray.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toPrimitive.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toPropertyKey.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toSetter.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/typeof.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/unsupportedIterableToArray.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/using.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/usingCtx.js +59 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/wrapAsyncGenerator.js +69 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/wrapNativeSuper.js +27 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/wrapRegExp.js +51 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/writeOnlyError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/extends.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/get.js +11 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/getPrototypeOf.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/identity.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/importDeferProxy.js +27 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/inherits.js +14 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/inheritsLoose.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/initializerDefineProperty.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/initializerWarningHelper.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/instanceof.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/interopRequireDefault.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/interopRequireWildcard.js +27 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/isNativeFunction.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/isNativeReflectConstruct.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/iterableToArray.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/iterableToArrayLimit.js +28 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/jsx.js +22 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/maybeArrayLike.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/newArrowCheck.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/nonIterableRest.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/nonIterableSpread.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/nullishReceiverError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectDestructuringEmpty.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectSpread.js +14 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js +23 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js +13 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/possibleConstructorReturn.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/readOnlyError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/regeneratorRuntime.js +304 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/set.js +22 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/setFunctionName.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/setPrototypeOf.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/skipFirstGeneratorNext.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/slicedToArray.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/superPropBase.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/superPropGet.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/superPropSet.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/taggedTemplateLiteral.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/taggedTemplateLiteralLoose.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/tdz.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/temporalRef.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/temporalUndefined.js +2 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/toArray.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/toConsumableArray.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/toSetter.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/typeof.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/unsupportedIterableToArray.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/using.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js +59 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js +69 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/wrapNativeSuper.js +27 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/wrapRegExp.js +51 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/writeOnlyError.js +4 -0
- package/runtime/node_modules/@oxc-project/types/LICENSE +22 -0
- package/runtime/node_modules/@oxc-project/types/README.md +3 -0
- package/runtime/node_modules/@oxc-project/types/package.json +26 -0
- package/runtime/node_modules/@oxc-project/types/types.d.ts +1912 -0
- package/runtime/node_modules/@oxc-transform/binding-linux-x64-gnu/README.md +3 -0
- package/runtime/node_modules/@oxc-transform/binding-linux-x64-gnu/package.json +44 -0
- package/runtime/node_modules/@oxc-transform/binding-linux-x64-gnu/transform.linux-x64-gnu.node +0 -0
- package/runtime/node_modules/@petamoriken/float16/LICENSE +21 -0
- package/runtime/node_modules/@petamoriken/float16/README.md +413 -0
- package/runtime/node_modules/@petamoriken/float16/browser/float16.js +1340 -0
- package/runtime/node_modules/@petamoriken/float16/browser/float16.mjs +1325 -0
- package/runtime/node_modules/@petamoriken/float16/index.d.ts +546 -0
- package/runtime/node_modules/@petamoriken/float16/index.v5.6.d.ts +546 -0
- package/runtime/node_modules/@petamoriken/float16/index.v5.7.d.ts +555 -0
- package/runtime/node_modules/@petamoriken/float16/inspect/node.cjs +25 -0
- package/runtime/node_modules/@petamoriken/float16/inspect/node.mjs +23 -0
- package/runtime/node_modules/@petamoriken/float16/lib/DataView.cjs +16 -0
- package/runtime/node_modules/@petamoriken/float16/lib/Float16Array.cjs +690 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/arrayIterator.cjs +52 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/brand.cjs +27 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/converter.cjs +111 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/is.cjs +78 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/messages.cjs +18 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/primordials.cjs +150 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/spec.cjs +84 -0
- package/runtime/node_modules/@petamoriken/float16/lib/f16round.cjs +10 -0
- package/runtime/node_modules/@petamoriken/float16/lib/index.cjs +16 -0
- package/runtime/node_modules/@petamoriken/float16/lib/isTypedArray.cjs +11 -0
- package/runtime/node_modules/@petamoriken/float16/package.json +115 -0
- package/runtime/node_modules/@petamoriken/float16/src/DataView.mjs +35 -0
- package/runtime/node_modules/@petamoriken/float16/src/Float16Array.mjs +1194 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/arrayIterator.mjs +86 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/brand.mjs +31 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/converter.mjs +173 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/is.mjs +151 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/messages.mjs +22 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/primordials.mjs +254 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/spec.mjs +137 -0
- package/runtime/node_modules/@petamoriken/float16/src/f16round.mjs +10 -0
- package/runtime/node_modules/@petamoriken/float16/src/index.mjs +7 -0
- package/runtime/node_modules/@petamoriken/float16/src/isTypedArray.mjs +10 -0
- package/runtime/node_modules/get-tsconfig/LICENSE +21 -0
- package/runtime/node_modules/get-tsconfig/README.md +268 -0
- package/runtime/node_modules/get-tsconfig/dist/index.cjs +7 -0
- package/runtime/node_modules/get-tsconfig/dist/index.d.cts +2116 -0
- package/runtime/node_modules/get-tsconfig/dist/index.d.mts +2116 -0
- package/runtime/node_modules/get-tsconfig/dist/index.mjs +7 -0
- package/runtime/node_modules/get-tsconfig/package.json +46 -0
- package/runtime/node_modules/jsbi/LICENSE +176 -0
- package/runtime/node_modules/jsbi/README.md +173 -0
- package/runtime/node_modules/jsbi/dist/jsbi-cjs.js +2 -0
- package/runtime/node_modules/jsbi/dist/jsbi-cjs.js.map +1 -0
- package/runtime/node_modules/jsbi/dist/jsbi-umd.js +2 -0
- package/runtime/node_modules/jsbi/dist/jsbi-umd.js.map +1 -0
- package/runtime/node_modules/jsbi/dist/jsbi.mjs +2 -0
- package/runtime/node_modules/jsbi/dist/jsbi.mjs.map +1 -0
- package/runtime/node_modules/jsbi/jsbi.d.ts +43 -0
- package/runtime/node_modules/jsbi/package.json +35 -0
- package/runtime/node_modules/oxc-parser/LICENSE +22 -0
- package/runtime/node_modules/oxc-parser/README.md +167 -0
- package/runtime/node_modules/oxc-parser/package.json +153 -0
- package/runtime/node_modules/oxc-parser/src-js/bindings.js +601 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/constants.js +105 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/js.js +5862 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/js_range.js +6403 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/ts.js +6154 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/ts_range.js +6723 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/lazy/constructors.js +13875 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/lazy/type_ids.js +191 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/lazy/walk.js +5810 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/visit/keys.js +220 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/visit/type_ids.js +177 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/visit/visitor.d.ts +387 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/visit/walk.js +2455 -0
- package/runtime/node_modules/oxc-parser/src-js/index.d.ts +312 -0
- package/runtime/node_modules/oxc-parser/src-js/index.js +108 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/common.js +301 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/eager.js +255 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/lazy-common.js +11 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/lazy.js +162 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/node-array.js +365 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/supported.js +52 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/visitor.js +127 -0
- package/runtime/node_modules/oxc-parser/src-js/visit/index.js +41 -0
- package/runtime/node_modules/oxc-parser/src-js/visit/visitor.js +405 -0
- package/runtime/node_modules/oxc-parser/src-js/wasm.js +13 -0
- package/runtime/node_modules/oxc-parser/src-js/webcontainer-fallback.cjs +21 -0
- package/runtime/node_modules/oxc-parser/src-js/wrap.js +57 -0
- package/runtime/node_modules/oxc-transform/LICENSE +22 -0
- package/runtime/node_modules/oxc-transform/README.md +84 -0
- package/runtime/node_modules/oxc-transform/browser.js +1 -0
- package/runtime/node_modules/oxc-transform/index.d.ts +658 -0
- package/runtime/node_modules/oxc-transform/index.js +598 -0
- package/runtime/node_modules/oxc-transform/package.json +114 -0
- package/runtime/node_modules/oxc-transform/webcontainer-fallback.cjs +21 -0
- package/runtime/node_modules/resolve-pkg-maps/LICENSE +21 -0
- package/runtime/node_modules/resolve-pkg-maps/README.md +216 -0
- package/runtime/node_modules/resolve-pkg-maps/dist/index.cjs +1 -0
- package/runtime/node_modules/resolve-pkg-maps/dist/index.d.cts +11 -0
- package/runtime/node_modules/resolve-pkg-maps/dist/index.d.mts +11 -0
- package/runtime/node_modules/resolve-pkg-maps/dist/index.mjs +1 -0
- package/runtime/node_modules/resolve-pkg-maps/package.json +42 -0
- package/runtime/node_modules/urlpattern-polyfill/LICENSE +19 -0
- package/runtime/node_modules/urlpattern-polyfill/README.md +242 -0
- package/runtime/node_modules/urlpattern-polyfill/dist/index.d.ts +9 -0
- package/runtime/node_modules/urlpattern-polyfill/dist/types.d.ts +49 -0
- package/runtime/node_modules/urlpattern-polyfill/dist/urlpattern.cjs +1 -0
- package/runtime/node_modules/urlpattern-polyfill/dist/urlpattern.js +1 -0
- package/runtime/node_modules/urlpattern-polyfill/index.cjs +7 -0
- package/runtime/node_modules/urlpattern-polyfill/index.js +7 -0
- package/runtime/node_modules/urlpattern-polyfill/package.json +149 -0
- package/runtime/version.mjs +1 -1
|
@@ -0,0 +1,1194 @@
|
|
|
1
|
+
import { safeIfNeeded, wrap } from "./_util/arrayIterator.mjs";
|
|
2
|
+
import { brand, hasFloat16ArrayBrand } from "./_util/brand.mjs";
|
|
3
|
+
import { convertToNumber, roundToFloat16Bits } from "./_util/converter.mjs";
|
|
4
|
+
import {
|
|
5
|
+
isAnyArrayBuffer,
|
|
6
|
+
isCanonicalIntegerIndexString,
|
|
7
|
+
isNativeBigIntTypedArray,
|
|
8
|
+
isNativeTypedArray,
|
|
9
|
+
isObject,
|
|
10
|
+
isOrdinaryArray,
|
|
11
|
+
isOrdinaryNativeTypedArray,
|
|
12
|
+
} from "./_util/is.mjs";
|
|
13
|
+
import {
|
|
14
|
+
ATTEMPTING_TO_ACCESS_DETACHED_ARRAYBUFFER,
|
|
15
|
+
CANNOT_CONVERT_UNDEFINED_OR_NULL_TO_OBJECT,
|
|
16
|
+
CANNOT_MIX_BIGINT_AND_OTHER_TYPES,
|
|
17
|
+
DERIVED_CONSTRUCTOR_CREATED_TYPEDARRAY_OBJECT_WHICH_WAS_TOO_SMALL_LENGTH,
|
|
18
|
+
ITERATOR_PROPERTY_IS_NOT_CALLABLE,
|
|
19
|
+
OFFSET_IS_OUT_OF_BOUNDS,
|
|
20
|
+
REDUCE_OF_EMPTY_ARRAY_WITH_NO_INITIAL_VALUE,
|
|
21
|
+
SPECIES_CONSTRUCTOR_DIDNT_RETURN_TYPEDARRAY_OBJECT,
|
|
22
|
+
THE_COMPARISON_FUNCTION_MUST_BE_EITHER_A_FUNCTION_OR_UNDEFINED,
|
|
23
|
+
THIS_CONSTRUCTOR_IS_NOT_A_SUBCLASS_OF_FLOAT16ARRAY,
|
|
24
|
+
THIS_IS_NOT_A_FLOAT16ARRAY_OBJECT,
|
|
25
|
+
} from "./_util/messages.mjs";
|
|
26
|
+
import {
|
|
27
|
+
ArrayBufferIsView,
|
|
28
|
+
ArrayPrototypeJoin,
|
|
29
|
+
ArrayPrototypePush,
|
|
30
|
+
ArrayPrototypeToLocaleString,
|
|
31
|
+
NativeArrayBuffer,
|
|
32
|
+
NativeObject,
|
|
33
|
+
NativeProxy,
|
|
34
|
+
NativeRangeError,
|
|
35
|
+
NativeTypeError,
|
|
36
|
+
NativeUint16Array,
|
|
37
|
+
NativeWeakMap,
|
|
38
|
+
NativeWeakSet,
|
|
39
|
+
NumberIsNaN,
|
|
40
|
+
ObjectDefineProperty,
|
|
41
|
+
ObjectFreeze,
|
|
42
|
+
ObjectHasOwn,
|
|
43
|
+
ObjectPrototype__lookupGetter__,
|
|
44
|
+
ReflectApply,
|
|
45
|
+
ReflectConstruct,
|
|
46
|
+
ReflectDefineProperty,
|
|
47
|
+
ReflectGet,
|
|
48
|
+
ReflectGetOwnPropertyDescriptor,
|
|
49
|
+
ReflectHas,
|
|
50
|
+
ReflectOwnKeys,
|
|
51
|
+
ReflectSet,
|
|
52
|
+
ReflectSetPrototypeOf,
|
|
53
|
+
SymbolIterator,
|
|
54
|
+
SymbolToStringTag,
|
|
55
|
+
TypedArray,
|
|
56
|
+
TypedArrayPrototype,
|
|
57
|
+
TypedArrayPrototypeCopyWithin,
|
|
58
|
+
TypedArrayPrototypeEntries,
|
|
59
|
+
TypedArrayPrototypeFill,
|
|
60
|
+
TypedArrayPrototypeGetBuffer,
|
|
61
|
+
TypedArrayPrototypeGetByteOffset,
|
|
62
|
+
TypedArrayPrototypeGetLength,
|
|
63
|
+
TypedArrayPrototypeKeys,
|
|
64
|
+
TypedArrayPrototypeReverse,
|
|
65
|
+
TypedArrayPrototypeSet,
|
|
66
|
+
TypedArrayPrototypeSlice,
|
|
67
|
+
TypedArrayPrototypeSort,
|
|
68
|
+
TypedArrayPrototypeSubarray,
|
|
69
|
+
TypedArrayPrototypeValues,
|
|
70
|
+
Uint16ArrayFrom,
|
|
71
|
+
WeakMapPrototypeGet,
|
|
72
|
+
WeakMapPrototypeHas,
|
|
73
|
+
WeakMapPrototypeSet,
|
|
74
|
+
WeakSetPrototypeAdd,
|
|
75
|
+
WeakSetPrototypeHas,
|
|
76
|
+
} from "./_util/primordials.mjs";
|
|
77
|
+
import {
|
|
78
|
+
IsDetachedBuffer,
|
|
79
|
+
SpeciesConstructor,
|
|
80
|
+
ToIntegerOrInfinity,
|
|
81
|
+
ToLength,
|
|
82
|
+
defaultCompare,
|
|
83
|
+
} from "./_util/spec.mjs";
|
|
84
|
+
|
|
85
|
+
const BYTES_PER_ELEMENT = 2;
|
|
86
|
+
|
|
87
|
+
/** @typedef {Uint16Array & { __float16bits: never }} Float16BitsArray */
|
|
88
|
+
|
|
89
|
+
/** @type {WeakMap<Float16Array, Float16BitsArray>} */
|
|
90
|
+
const float16bitsArrays = new NativeWeakMap();
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @param {unknown} target
|
|
94
|
+
* @returns {target is Float16Array}
|
|
95
|
+
*/
|
|
96
|
+
export function isFloat16Array(target) {
|
|
97
|
+
return WeakMapPrototypeHas(float16bitsArrays, target) ||
|
|
98
|
+
(!ArrayBufferIsView(target) && hasFloat16ArrayBrand(target));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @param {unknown} target
|
|
103
|
+
* @throws {TypeError}
|
|
104
|
+
* @returns {asserts target is Float16Array}
|
|
105
|
+
*/
|
|
106
|
+
function assertFloat16Array(target) {
|
|
107
|
+
if (!isFloat16Array(target)) {
|
|
108
|
+
throw NativeTypeError(THIS_IS_NOT_A_FLOAT16ARRAY_OBJECT);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @param {unknown} target
|
|
114
|
+
* @param {number=} count
|
|
115
|
+
* @throws {TypeError}
|
|
116
|
+
* @returns {asserts target is Uint8Array|Uint8ClampedArray|Uint16Array|Uint32Array|Int8Array|Int16Array|Int32Array|Float16Array|Float32Array|Float64Array}
|
|
117
|
+
*/
|
|
118
|
+
function assertSpeciesTypedArray(target, count) {
|
|
119
|
+
const isTargetFloat16Array = isFloat16Array(target);
|
|
120
|
+
const isTargetTypedArray = isNativeTypedArray(target);
|
|
121
|
+
|
|
122
|
+
if (!isTargetFloat16Array && !isTargetTypedArray) {
|
|
123
|
+
throw NativeTypeError(SPECIES_CONSTRUCTOR_DIDNT_RETURN_TYPEDARRAY_OBJECT);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (typeof count === "number") {
|
|
127
|
+
let length;
|
|
128
|
+
if (isTargetFloat16Array) {
|
|
129
|
+
const float16bitsArray = getFloat16BitsArray(target);
|
|
130
|
+
length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
131
|
+
} else {
|
|
132
|
+
length = TypedArrayPrototypeGetLength(target);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (length < count) {
|
|
136
|
+
throw NativeTypeError(
|
|
137
|
+
DERIVED_CONSTRUCTOR_CREATED_TYPEDARRAY_OBJECT_WHICH_WAS_TOO_SMALL_LENGTH
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (isNativeBigIntTypedArray(target)) {
|
|
143
|
+
throw NativeTypeError(CANNOT_MIX_BIGINT_AND_OTHER_TYPES);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @param {Float16Array} float16
|
|
149
|
+
* @throws {TypeError}
|
|
150
|
+
* @returns {Float16BitsArray}
|
|
151
|
+
*/
|
|
152
|
+
function getFloat16BitsArray(float16) {
|
|
153
|
+
const float16bitsArray = WeakMapPrototypeGet(float16bitsArrays, float16);
|
|
154
|
+
if (float16bitsArray !== undefined) {
|
|
155
|
+
const buffer = TypedArrayPrototypeGetBuffer(float16bitsArray);
|
|
156
|
+
|
|
157
|
+
if (IsDetachedBuffer(buffer)) {
|
|
158
|
+
throw NativeTypeError(ATTEMPTING_TO_ACCESS_DETACHED_ARRAYBUFFER);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return float16bitsArray;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// from another Float16Array instance (a different version?)
|
|
165
|
+
const buffer = /** @type {any} */ (float16).buffer;
|
|
166
|
+
|
|
167
|
+
if (IsDetachedBuffer(buffer)) {
|
|
168
|
+
throw NativeTypeError(ATTEMPTING_TO_ACCESS_DETACHED_ARRAYBUFFER);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const cloned = ReflectConstruct(Float16Array, [
|
|
172
|
+
buffer,
|
|
173
|
+
/** @type {any} */ (float16).byteOffset,
|
|
174
|
+
/** @type {any} */ (float16).length,
|
|
175
|
+
], float16.constructor);
|
|
176
|
+
return WeakMapPrototypeGet(float16bitsArrays, cloned);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* @param {Float16BitsArray} float16bitsArray
|
|
181
|
+
* @returns {number[]}
|
|
182
|
+
*/
|
|
183
|
+
function copyToArray(float16bitsArray) {
|
|
184
|
+
const length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
185
|
+
|
|
186
|
+
const array = [];
|
|
187
|
+
for (let i = 0; i < length; ++i) {
|
|
188
|
+
array[i] = convertToNumber(float16bitsArray[i]);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return array;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** @type {WeakSet<Function>} */
|
|
195
|
+
const TypedArrayPrototypeGetters = new NativeWeakSet();
|
|
196
|
+
for (const key of ReflectOwnKeys(TypedArrayPrototype)) {
|
|
197
|
+
// @@toStringTag getter property is defined in Float16Array.prototype
|
|
198
|
+
if (key === SymbolToStringTag) {
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const descriptor = ReflectGetOwnPropertyDescriptor(TypedArrayPrototype, key);
|
|
203
|
+
if (ObjectHasOwn(descriptor, "get") && typeof descriptor.get === "function") {
|
|
204
|
+
WeakSetPrototypeAdd(TypedArrayPrototypeGetters, descriptor.get);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const handler = ObjectFreeze(/** @type {ProxyHandler<Float16BitsArray>} */ ({
|
|
209
|
+
get(target, key, receiver) {
|
|
210
|
+
if (isCanonicalIntegerIndexString(key) && ObjectHasOwn(target, key)) {
|
|
211
|
+
return convertToNumber(ReflectGet(target, key));
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// %TypedArray%.prototype getter properties cannot called by Proxy receiver
|
|
215
|
+
if (WeakSetPrototypeHas(TypedArrayPrototypeGetters, ObjectPrototype__lookupGetter__(target, key))) {
|
|
216
|
+
return ReflectGet(target, key);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return ReflectGet(target, key, receiver);
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
set(target, key, value, receiver) {
|
|
223
|
+
if (isCanonicalIntegerIndexString(key) && ObjectHasOwn(target, key)) {
|
|
224
|
+
return ReflectSet(target, key, roundToFloat16Bits(value));
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return ReflectSet(target, key, value, receiver);
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
getOwnPropertyDescriptor(target, key) {
|
|
231
|
+
if (isCanonicalIntegerIndexString(key) && ObjectHasOwn(target, key)) {
|
|
232
|
+
const descriptor = ReflectGetOwnPropertyDescriptor(target, key);
|
|
233
|
+
descriptor.value = convertToNumber(descriptor.value);
|
|
234
|
+
return descriptor;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return ReflectGetOwnPropertyDescriptor(target, key);
|
|
238
|
+
},
|
|
239
|
+
|
|
240
|
+
defineProperty(target, key, descriptor) {
|
|
241
|
+
if (
|
|
242
|
+
isCanonicalIntegerIndexString(key) &&
|
|
243
|
+
ObjectHasOwn(target, key) &&
|
|
244
|
+
ObjectHasOwn(descriptor, "value")
|
|
245
|
+
) {
|
|
246
|
+
descriptor.value = roundToFloat16Bits(descriptor.value);
|
|
247
|
+
return ReflectDefineProperty(target, key, descriptor);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return ReflectDefineProperty(target, key, descriptor);
|
|
251
|
+
},
|
|
252
|
+
}));
|
|
253
|
+
|
|
254
|
+
export class Float16Array {
|
|
255
|
+
/** @see https://tc39.es/ecma262/#sec-typedarray */
|
|
256
|
+
constructor(input, _byteOffset, _length) {
|
|
257
|
+
/** @type {Float16BitsArray} */
|
|
258
|
+
let float16bitsArray;
|
|
259
|
+
|
|
260
|
+
if (isFloat16Array(input)) {
|
|
261
|
+
float16bitsArray = ReflectConstruct(NativeUint16Array, [getFloat16BitsArray(input)], new.target);
|
|
262
|
+
} else if (isObject(input) && !isAnyArrayBuffer(input)) { // object without ArrayBuffer, SharedArrayBuffer
|
|
263
|
+
/** @type {ArrayLike<unknown>} */
|
|
264
|
+
let list;
|
|
265
|
+
/** @type {number} */
|
|
266
|
+
let length;
|
|
267
|
+
|
|
268
|
+
if (isNativeTypedArray(input)) { // TypedArray
|
|
269
|
+
list = input;
|
|
270
|
+
length = TypedArrayPrototypeGetLength(input);
|
|
271
|
+
|
|
272
|
+
const buffer = TypedArrayPrototypeGetBuffer(input);
|
|
273
|
+
|
|
274
|
+
if (IsDetachedBuffer(buffer)) {
|
|
275
|
+
throw NativeTypeError(ATTEMPTING_TO_ACCESS_DETACHED_ARRAYBUFFER);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (isNativeBigIntTypedArray(input)) {
|
|
279
|
+
throw NativeTypeError(CANNOT_MIX_BIGINT_AND_OTHER_TYPES);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const data = new NativeArrayBuffer(
|
|
283
|
+
length * BYTES_PER_ELEMENT
|
|
284
|
+
);
|
|
285
|
+
float16bitsArray = ReflectConstruct(NativeUint16Array, [data], new.target);
|
|
286
|
+
} else {
|
|
287
|
+
const iterator = input[SymbolIterator];
|
|
288
|
+
if (iterator != null && typeof iterator !== "function") {
|
|
289
|
+
throw NativeTypeError(ITERATOR_PROPERTY_IS_NOT_CALLABLE);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (iterator != null) { // Iterable (Array)
|
|
293
|
+
// for optimization
|
|
294
|
+
if (isOrdinaryArray(input)) {
|
|
295
|
+
list = input;
|
|
296
|
+
length = input.length;
|
|
297
|
+
} else {
|
|
298
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
299
|
+
list = [... /** @type {Iterable<unknown>} */ (input)];
|
|
300
|
+
length = list.length;
|
|
301
|
+
}
|
|
302
|
+
} else { // ArrayLike
|
|
303
|
+
list = /** @type {ArrayLike<unknown>} */ (input);
|
|
304
|
+
length = ToLength(list.length);
|
|
305
|
+
}
|
|
306
|
+
float16bitsArray = ReflectConstruct(NativeUint16Array, [length], new.target);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// set values
|
|
310
|
+
for (let i = 0; i < length; ++i) {
|
|
311
|
+
float16bitsArray[i] = roundToFloat16Bits(list[i]);
|
|
312
|
+
}
|
|
313
|
+
} else { // primitive, ArrayBuffer, SharedArrayBuffer
|
|
314
|
+
float16bitsArray = ReflectConstruct(NativeUint16Array, arguments, new.target);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/** @type {Float16Array} */
|
|
318
|
+
const proxy = /** @type {any} */ (new NativeProxy(float16bitsArray, handler));
|
|
319
|
+
|
|
320
|
+
// proxy private storage
|
|
321
|
+
WeakMapPrototypeSet(float16bitsArrays, proxy, float16bitsArray);
|
|
322
|
+
|
|
323
|
+
return proxy;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* limitation: `Object.getOwnPropertyNames(Float16Array)` or `Reflect.ownKeys(Float16Array)` include this key
|
|
328
|
+
* @see https://tc39.es/ecma262/#sec-%typedarray%.from
|
|
329
|
+
*/
|
|
330
|
+
static from(src, ...opts) {
|
|
331
|
+
const Constructor = this;
|
|
332
|
+
|
|
333
|
+
if (!ReflectHas(Constructor, brand)) {
|
|
334
|
+
throw NativeTypeError(
|
|
335
|
+
THIS_CONSTRUCTOR_IS_NOT_A_SUBCLASS_OF_FLOAT16ARRAY
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// for optimization
|
|
340
|
+
if (Constructor === Float16Array) {
|
|
341
|
+
if (isFloat16Array(src) && opts.length === 0) {
|
|
342
|
+
const float16bitsArray = getFloat16BitsArray(src);
|
|
343
|
+
const uint16 = new NativeUint16Array(
|
|
344
|
+
TypedArrayPrototypeGetBuffer(float16bitsArray),
|
|
345
|
+
TypedArrayPrototypeGetByteOffset(float16bitsArray),
|
|
346
|
+
TypedArrayPrototypeGetLength(float16bitsArray)
|
|
347
|
+
);
|
|
348
|
+
return new Float16Array(
|
|
349
|
+
TypedArrayPrototypeGetBuffer(TypedArrayPrototypeSlice(uint16))
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (opts.length === 0) {
|
|
354
|
+
return new Float16Array(
|
|
355
|
+
TypedArrayPrototypeGetBuffer(
|
|
356
|
+
Uint16ArrayFrom(src, roundToFloat16Bits)
|
|
357
|
+
)
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const mapFunc = opts[0];
|
|
362
|
+
const thisArg = opts[1];
|
|
363
|
+
|
|
364
|
+
return new Float16Array(
|
|
365
|
+
TypedArrayPrototypeGetBuffer(
|
|
366
|
+
Uint16ArrayFrom(src, function (val, ...args) {
|
|
367
|
+
return roundToFloat16Bits(
|
|
368
|
+
ReflectApply(mapFunc, this, [val, ...safeIfNeeded(args)])
|
|
369
|
+
);
|
|
370
|
+
}, thisArg)
|
|
371
|
+
)
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/** @type {ArrayLike<unknown>} */
|
|
376
|
+
let list;
|
|
377
|
+
/** @type {number} */
|
|
378
|
+
let length;
|
|
379
|
+
|
|
380
|
+
const iterator = src[SymbolIterator];
|
|
381
|
+
if (iterator != null && typeof iterator !== "function") {
|
|
382
|
+
throw NativeTypeError(ITERATOR_PROPERTY_IS_NOT_CALLABLE);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
if (iterator != null) { // Iterable (TypedArray, Array)
|
|
386
|
+
// for optimization
|
|
387
|
+
if (isOrdinaryArray(src)) {
|
|
388
|
+
list = src;
|
|
389
|
+
length = src.length;
|
|
390
|
+
} else if (isOrdinaryNativeTypedArray(src)) {
|
|
391
|
+
list = src;
|
|
392
|
+
length = TypedArrayPrototypeGetLength(src);
|
|
393
|
+
} else {
|
|
394
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
395
|
+
list = [...src];
|
|
396
|
+
length = list.length;
|
|
397
|
+
}
|
|
398
|
+
} else { // ArrayLike
|
|
399
|
+
if (src == null) {
|
|
400
|
+
throw NativeTypeError(
|
|
401
|
+
CANNOT_CONVERT_UNDEFINED_OR_NULL_TO_OBJECT
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
list = NativeObject(src);
|
|
405
|
+
length = ToLength(list.length);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
const array = new Constructor(length);
|
|
409
|
+
|
|
410
|
+
if (opts.length === 0) {
|
|
411
|
+
for (let i = 0; i < length; ++i) {
|
|
412
|
+
array[i] = /** @type {number} */ (list[i]);
|
|
413
|
+
}
|
|
414
|
+
} else {
|
|
415
|
+
const mapFunc = opts[0];
|
|
416
|
+
const thisArg = opts[1];
|
|
417
|
+
for (let i = 0; i < length; ++i) {
|
|
418
|
+
array[i] = ReflectApply(mapFunc, thisArg, [list[i], i]);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
return array;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* limitation: `Object.getOwnPropertyNames(Float16Array)` or `Reflect.ownKeys(Float16Array)` include this key
|
|
427
|
+
* @see https://tc39.es/ecma262/#sec-%typedarray%.of
|
|
428
|
+
*/
|
|
429
|
+
static of(...items) {
|
|
430
|
+
const Constructor = this;
|
|
431
|
+
|
|
432
|
+
if (!ReflectHas(Constructor, brand)) {
|
|
433
|
+
throw NativeTypeError(
|
|
434
|
+
THIS_CONSTRUCTOR_IS_NOT_A_SUBCLASS_OF_FLOAT16ARRAY
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
const length = items.length;
|
|
439
|
+
|
|
440
|
+
// for optimization
|
|
441
|
+
if (Constructor === Float16Array) {
|
|
442
|
+
const proxy = new Float16Array(length);
|
|
443
|
+
const float16bitsArray = getFloat16BitsArray(proxy);
|
|
444
|
+
|
|
445
|
+
for (let i = 0; i < length; ++i) {
|
|
446
|
+
float16bitsArray[i] = roundToFloat16Bits(items[i]);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
return proxy;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
const array = new Constructor(length);
|
|
453
|
+
|
|
454
|
+
for (let i = 0; i < length; ++i) {
|
|
455
|
+
array[i] = items[i];
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
return array;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.keys */
|
|
462
|
+
keys() {
|
|
463
|
+
assertFloat16Array(this);
|
|
464
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
465
|
+
|
|
466
|
+
return TypedArrayPrototypeKeys(float16bitsArray);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* limitation: returns a object whose prototype is not `%ArrayIteratorPrototype%`
|
|
471
|
+
* @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.values
|
|
472
|
+
*/
|
|
473
|
+
values() {
|
|
474
|
+
assertFloat16Array(this);
|
|
475
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
476
|
+
|
|
477
|
+
return wrap((function* () {
|
|
478
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
479
|
+
for (const val of TypedArrayPrototypeValues(float16bitsArray)) {
|
|
480
|
+
yield convertToNumber(val);
|
|
481
|
+
}
|
|
482
|
+
})());
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* limitation: returns a object whose prototype is not `%ArrayIteratorPrototype%`
|
|
487
|
+
* @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.entries
|
|
488
|
+
*/
|
|
489
|
+
entries() {
|
|
490
|
+
assertFloat16Array(this);
|
|
491
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
492
|
+
|
|
493
|
+
return wrap((function* () {
|
|
494
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
495
|
+
for (const [i, val] of TypedArrayPrototypeEntries(float16bitsArray)) {
|
|
496
|
+
yield /** @type {[number, number]} */ ([i, convertToNumber(val)]);
|
|
497
|
+
}
|
|
498
|
+
})());
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.at */
|
|
502
|
+
at(index) {
|
|
503
|
+
assertFloat16Array(this);
|
|
504
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
505
|
+
|
|
506
|
+
const length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
507
|
+
const relativeIndex = ToIntegerOrInfinity(index);
|
|
508
|
+
const k = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;
|
|
509
|
+
|
|
510
|
+
if (k < 0 || k >= length) {
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
return convertToNumber(float16bitsArray[k]);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/** @see https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.with */
|
|
518
|
+
with(index, value) {
|
|
519
|
+
assertFloat16Array(this);
|
|
520
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
521
|
+
|
|
522
|
+
const length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
523
|
+
const relativeIndex = ToIntegerOrInfinity(index);
|
|
524
|
+
const k = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;
|
|
525
|
+
|
|
526
|
+
const number = +value;
|
|
527
|
+
|
|
528
|
+
if (k < 0 || k >= length) {
|
|
529
|
+
throw NativeRangeError(OFFSET_IS_OUT_OF_BOUNDS);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
// don't use SpeciesConstructor
|
|
533
|
+
const uint16 = new NativeUint16Array(
|
|
534
|
+
TypedArrayPrototypeGetBuffer(float16bitsArray),
|
|
535
|
+
TypedArrayPrototypeGetByteOffset(float16bitsArray),
|
|
536
|
+
TypedArrayPrototypeGetLength(float16bitsArray)
|
|
537
|
+
);
|
|
538
|
+
const cloned = new Float16Array(
|
|
539
|
+
TypedArrayPrototypeGetBuffer(
|
|
540
|
+
TypedArrayPrototypeSlice(uint16)
|
|
541
|
+
)
|
|
542
|
+
);
|
|
543
|
+
const array = getFloat16BitsArray(cloned);
|
|
544
|
+
|
|
545
|
+
array[k] = roundToFloat16Bits(number);
|
|
546
|
+
|
|
547
|
+
return cloned;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.map */
|
|
551
|
+
map(callback, ...opts) {
|
|
552
|
+
assertFloat16Array(this);
|
|
553
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
554
|
+
|
|
555
|
+
const length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
556
|
+
const thisArg = opts[0];
|
|
557
|
+
|
|
558
|
+
const Constructor = SpeciesConstructor(float16bitsArray, Float16Array);
|
|
559
|
+
|
|
560
|
+
// for optimization
|
|
561
|
+
if (Constructor === Float16Array) {
|
|
562
|
+
const proxy = new Float16Array(length);
|
|
563
|
+
const array = getFloat16BitsArray(proxy);
|
|
564
|
+
|
|
565
|
+
for (let i = 0; i < length; ++i) {
|
|
566
|
+
const val = convertToNumber(float16bitsArray[i]);
|
|
567
|
+
array[i] = roundToFloat16Bits(
|
|
568
|
+
ReflectApply(callback, thisArg, [val, i, this])
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
return proxy;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
const array = new Constructor(length);
|
|
576
|
+
assertSpeciesTypedArray(array, length);
|
|
577
|
+
|
|
578
|
+
for (let i = 0; i < length; ++i) {
|
|
579
|
+
const val = convertToNumber(float16bitsArray[i]);
|
|
580
|
+
array[i] = ReflectApply(callback, thisArg, [val, i, this]);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
return /** @type {any} */ (array);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.filter */
|
|
587
|
+
filter(callback, ...opts) {
|
|
588
|
+
assertFloat16Array(this);
|
|
589
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
590
|
+
|
|
591
|
+
const length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
592
|
+
const thisArg = opts[0];
|
|
593
|
+
|
|
594
|
+
const kept = [];
|
|
595
|
+
for (let i = 0; i < length; ++i) {
|
|
596
|
+
const val = convertToNumber(float16bitsArray[i]);
|
|
597
|
+
if (ReflectApply(callback, thisArg, [val, i, this])) {
|
|
598
|
+
ArrayPrototypePush(kept, val);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
const Constructor = SpeciesConstructor(float16bitsArray, Float16Array);
|
|
603
|
+
const array = new Constructor(kept);
|
|
604
|
+
assertSpeciesTypedArray(array);
|
|
605
|
+
|
|
606
|
+
return /** @type {any} */ (array);
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduce */
|
|
610
|
+
reduce(callback, ...opts) {
|
|
611
|
+
assertFloat16Array(this);
|
|
612
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
613
|
+
|
|
614
|
+
const length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
615
|
+
if (length === 0 && opts.length === 0) {
|
|
616
|
+
throw NativeTypeError(REDUCE_OF_EMPTY_ARRAY_WITH_NO_INITIAL_VALUE);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
let accumulator, start;
|
|
620
|
+
if (opts.length === 0) {
|
|
621
|
+
accumulator = convertToNumber(float16bitsArray[0]);
|
|
622
|
+
start = 1;
|
|
623
|
+
} else {
|
|
624
|
+
accumulator = opts[0];
|
|
625
|
+
start = 0;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
for (let i = start; i < length; ++i) {
|
|
629
|
+
accumulator = callback(
|
|
630
|
+
accumulator,
|
|
631
|
+
convertToNumber(float16bitsArray[i]),
|
|
632
|
+
i,
|
|
633
|
+
this
|
|
634
|
+
);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
return accumulator;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduceright */
|
|
641
|
+
reduceRight(callback, ...opts) {
|
|
642
|
+
assertFloat16Array(this);
|
|
643
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
644
|
+
|
|
645
|
+
const length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
646
|
+
if (length === 0 && opts.length === 0) {
|
|
647
|
+
throw NativeTypeError(REDUCE_OF_EMPTY_ARRAY_WITH_NO_INITIAL_VALUE);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
let accumulator, start;
|
|
651
|
+
if (opts.length === 0) {
|
|
652
|
+
accumulator = convertToNumber(float16bitsArray[length - 1]);
|
|
653
|
+
start = length - 2;
|
|
654
|
+
} else {
|
|
655
|
+
accumulator = opts[0];
|
|
656
|
+
start = length - 1;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
for (let i = start; i >= 0; --i) {
|
|
660
|
+
accumulator = callback(
|
|
661
|
+
accumulator,
|
|
662
|
+
convertToNumber(float16bitsArray[i]),
|
|
663
|
+
i,
|
|
664
|
+
this
|
|
665
|
+
);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
return accumulator;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.foreach */
|
|
672
|
+
forEach(callback, ...opts) {
|
|
673
|
+
assertFloat16Array(this);
|
|
674
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
675
|
+
|
|
676
|
+
const length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
677
|
+
const thisArg = opts[0];
|
|
678
|
+
|
|
679
|
+
for (let i = 0; i < length; ++i) {
|
|
680
|
+
ReflectApply(callback, thisArg, [
|
|
681
|
+
convertToNumber(float16bitsArray[i]),
|
|
682
|
+
i,
|
|
683
|
+
this,
|
|
684
|
+
]);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.find */
|
|
689
|
+
find(callback, ...opts) {
|
|
690
|
+
assertFloat16Array(this);
|
|
691
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
692
|
+
|
|
693
|
+
const length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
694
|
+
const thisArg = opts[0];
|
|
695
|
+
|
|
696
|
+
for (let i = 0; i < length; ++i) {
|
|
697
|
+
const value = convertToNumber(float16bitsArray[i]);
|
|
698
|
+
if (ReflectApply(callback, thisArg, [value, i, this])) {
|
|
699
|
+
return value;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.findindex */
|
|
705
|
+
findIndex(callback, ...opts) {
|
|
706
|
+
assertFloat16Array(this);
|
|
707
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
708
|
+
|
|
709
|
+
const length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
710
|
+
const thisArg = opts[0];
|
|
711
|
+
|
|
712
|
+
for (let i = 0; i < length; ++i) {
|
|
713
|
+
const value = convertToNumber(float16bitsArray[i]);
|
|
714
|
+
if (ReflectApply(callback, thisArg, [value, i, this])) {
|
|
715
|
+
return i;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
return -1;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
/** @see https://tc39.es/proposal-array-find-from-last/index.html#sec-%typedarray%.prototype.findlast */
|
|
723
|
+
findLast(callback, ...opts) {
|
|
724
|
+
assertFloat16Array(this);
|
|
725
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
726
|
+
|
|
727
|
+
const length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
728
|
+
const thisArg = opts[0];
|
|
729
|
+
|
|
730
|
+
for (let i = length - 1; i >= 0; --i) {
|
|
731
|
+
const value = convertToNumber(float16bitsArray[i]);
|
|
732
|
+
if (ReflectApply(callback, thisArg, [value, i, this])) {
|
|
733
|
+
return value;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/** @see https://tc39.es/proposal-array-find-from-last/index.html#sec-%typedarray%.prototype.findlastindex */
|
|
739
|
+
findLastIndex(callback, ...opts) {
|
|
740
|
+
assertFloat16Array(this);
|
|
741
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
742
|
+
|
|
743
|
+
const length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
744
|
+
const thisArg = opts[0];
|
|
745
|
+
|
|
746
|
+
for (let i = length - 1; i >= 0; --i) {
|
|
747
|
+
const value = convertToNumber(float16bitsArray[i]);
|
|
748
|
+
if (ReflectApply(callback, thisArg, [value, i, this])) {
|
|
749
|
+
return i;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
return -1;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.every */
|
|
757
|
+
every(callback, ...opts) {
|
|
758
|
+
assertFloat16Array(this);
|
|
759
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
760
|
+
|
|
761
|
+
const length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
762
|
+
const thisArg = opts[0];
|
|
763
|
+
|
|
764
|
+
for (let i = 0; i < length; ++i) {
|
|
765
|
+
if (
|
|
766
|
+
!ReflectApply(callback, thisArg, [
|
|
767
|
+
convertToNumber(float16bitsArray[i]),
|
|
768
|
+
i,
|
|
769
|
+
this,
|
|
770
|
+
])
|
|
771
|
+
) {
|
|
772
|
+
return false;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
return true;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.some */
|
|
780
|
+
some(callback, ...opts) {
|
|
781
|
+
assertFloat16Array(this);
|
|
782
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
783
|
+
|
|
784
|
+
const length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
785
|
+
const thisArg = opts[0];
|
|
786
|
+
|
|
787
|
+
for (let i = 0; i < length; ++i) {
|
|
788
|
+
if (
|
|
789
|
+
ReflectApply(callback, thisArg, [
|
|
790
|
+
convertToNumber(float16bitsArray[i]),
|
|
791
|
+
i,
|
|
792
|
+
this,
|
|
793
|
+
])
|
|
794
|
+
) {
|
|
795
|
+
return true;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
return false;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.set */
|
|
803
|
+
set(input, ...opts) {
|
|
804
|
+
assertFloat16Array(this);
|
|
805
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
806
|
+
|
|
807
|
+
const targetOffset = ToIntegerOrInfinity(opts[0]);
|
|
808
|
+
if (targetOffset < 0) {
|
|
809
|
+
throw NativeRangeError(OFFSET_IS_OUT_OF_BOUNDS);
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
if (input == null) {
|
|
813
|
+
throw NativeTypeError(
|
|
814
|
+
CANNOT_CONVERT_UNDEFINED_OR_NULL_TO_OBJECT
|
|
815
|
+
);
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
if (isNativeBigIntTypedArray(input)) {
|
|
819
|
+
throw NativeTypeError(
|
|
820
|
+
CANNOT_MIX_BIGINT_AND_OTHER_TYPES
|
|
821
|
+
);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
// for optimization
|
|
825
|
+
if (isFloat16Array(input)) {
|
|
826
|
+
// peel off Proxy
|
|
827
|
+
return TypedArrayPrototypeSet(
|
|
828
|
+
getFloat16BitsArray(this),
|
|
829
|
+
getFloat16BitsArray(input),
|
|
830
|
+
targetOffset
|
|
831
|
+
);
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
if (isNativeTypedArray(input)) {
|
|
835
|
+
const buffer = TypedArrayPrototypeGetBuffer(input);
|
|
836
|
+
if (IsDetachedBuffer(buffer)) {
|
|
837
|
+
throw NativeTypeError(ATTEMPTING_TO_ACCESS_DETACHED_ARRAYBUFFER);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
const targetLength = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
842
|
+
|
|
843
|
+
const src = NativeObject(input);
|
|
844
|
+
const srcLength = ToLength(src.length);
|
|
845
|
+
|
|
846
|
+
if (targetOffset === Infinity || srcLength + targetOffset > targetLength) {
|
|
847
|
+
throw NativeRangeError(OFFSET_IS_OUT_OF_BOUNDS);
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
for (let i = 0; i < srcLength; ++i) {
|
|
851
|
+
float16bitsArray[i + targetOffset] = roundToFloat16Bits(src[i]);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.reverse */
|
|
856
|
+
reverse() {
|
|
857
|
+
assertFloat16Array(this);
|
|
858
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
859
|
+
|
|
860
|
+
TypedArrayPrototypeReverse(float16bitsArray);
|
|
861
|
+
|
|
862
|
+
return this;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
/** @see https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toReversed */
|
|
866
|
+
toReversed() {
|
|
867
|
+
assertFloat16Array(this);
|
|
868
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
869
|
+
|
|
870
|
+
// don't use SpeciesConstructor
|
|
871
|
+
const uint16 = new NativeUint16Array(
|
|
872
|
+
TypedArrayPrototypeGetBuffer(float16bitsArray),
|
|
873
|
+
TypedArrayPrototypeGetByteOffset(float16bitsArray),
|
|
874
|
+
TypedArrayPrototypeGetLength(float16bitsArray)
|
|
875
|
+
);
|
|
876
|
+
const cloned = new Float16Array(
|
|
877
|
+
TypedArrayPrototypeGetBuffer(
|
|
878
|
+
TypedArrayPrototypeSlice(uint16)
|
|
879
|
+
)
|
|
880
|
+
);
|
|
881
|
+
|
|
882
|
+
const clonedFloat16bitsArray = getFloat16BitsArray(cloned);
|
|
883
|
+
TypedArrayPrototypeReverse(clonedFloat16bitsArray);
|
|
884
|
+
|
|
885
|
+
return cloned;
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill */
|
|
889
|
+
fill(value, ...opts) {
|
|
890
|
+
assertFloat16Array(this);
|
|
891
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
892
|
+
|
|
893
|
+
TypedArrayPrototypeFill(
|
|
894
|
+
float16bitsArray,
|
|
895
|
+
roundToFloat16Bits(value),
|
|
896
|
+
...safeIfNeeded(opts)
|
|
897
|
+
);
|
|
898
|
+
|
|
899
|
+
return this;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.copywithin */
|
|
903
|
+
copyWithin(target, start, ...opts) {
|
|
904
|
+
assertFloat16Array(this);
|
|
905
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
906
|
+
|
|
907
|
+
TypedArrayPrototypeCopyWithin(float16bitsArray, target, start, ...safeIfNeeded(opts));
|
|
908
|
+
|
|
909
|
+
return this;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.sort */
|
|
913
|
+
sort(compareFn) {
|
|
914
|
+
assertFloat16Array(this);
|
|
915
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
916
|
+
|
|
917
|
+
const sortCompare = compareFn !== undefined ? compareFn : defaultCompare;
|
|
918
|
+
TypedArrayPrototypeSort(float16bitsArray, (x, y) => {
|
|
919
|
+
return sortCompare(convertToNumber(x), convertToNumber(y));
|
|
920
|
+
});
|
|
921
|
+
|
|
922
|
+
return this;
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
/** @see https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toSorted */
|
|
926
|
+
toSorted(compareFn) {
|
|
927
|
+
assertFloat16Array(this);
|
|
928
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
929
|
+
|
|
930
|
+
if (compareFn !== undefined && typeof compareFn !== "function") {
|
|
931
|
+
throw new NativeTypeError(THE_COMPARISON_FUNCTION_MUST_BE_EITHER_A_FUNCTION_OR_UNDEFINED);
|
|
932
|
+
}
|
|
933
|
+
const sortCompare = compareFn !== undefined ? compareFn : defaultCompare;
|
|
934
|
+
|
|
935
|
+
// don't use SpeciesConstructor
|
|
936
|
+
const uint16 = new NativeUint16Array(
|
|
937
|
+
TypedArrayPrototypeGetBuffer(float16bitsArray),
|
|
938
|
+
TypedArrayPrototypeGetByteOffset(float16bitsArray),
|
|
939
|
+
TypedArrayPrototypeGetLength(float16bitsArray)
|
|
940
|
+
);
|
|
941
|
+
const cloned = new Float16Array(
|
|
942
|
+
TypedArrayPrototypeGetBuffer(
|
|
943
|
+
TypedArrayPrototypeSlice(uint16)
|
|
944
|
+
)
|
|
945
|
+
);
|
|
946
|
+
|
|
947
|
+
const clonedFloat16bitsArray = getFloat16BitsArray(cloned);
|
|
948
|
+
TypedArrayPrototypeSort(clonedFloat16bitsArray, (x, y) => {
|
|
949
|
+
return sortCompare(convertToNumber(x), convertToNumber(y));
|
|
950
|
+
});
|
|
951
|
+
|
|
952
|
+
return cloned;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.slice */
|
|
956
|
+
slice(start, end) {
|
|
957
|
+
assertFloat16Array(this);
|
|
958
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
959
|
+
|
|
960
|
+
const Constructor = SpeciesConstructor(float16bitsArray, Float16Array);
|
|
961
|
+
|
|
962
|
+
// for optimization
|
|
963
|
+
if (Constructor === Float16Array) {
|
|
964
|
+
const uint16 = new NativeUint16Array(
|
|
965
|
+
TypedArrayPrototypeGetBuffer(float16bitsArray),
|
|
966
|
+
TypedArrayPrototypeGetByteOffset(float16bitsArray),
|
|
967
|
+
TypedArrayPrototypeGetLength(float16bitsArray)
|
|
968
|
+
);
|
|
969
|
+
return new Float16Array(
|
|
970
|
+
TypedArrayPrototypeGetBuffer(
|
|
971
|
+
TypedArrayPrototypeSlice(uint16, start, end)
|
|
972
|
+
)
|
|
973
|
+
);
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
const length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
977
|
+
const relativeStart = ToIntegerOrInfinity(start);
|
|
978
|
+
const relativeEnd = end === undefined ? length : ToIntegerOrInfinity(end);
|
|
979
|
+
|
|
980
|
+
let k;
|
|
981
|
+
if (relativeStart === -Infinity) {
|
|
982
|
+
k = 0;
|
|
983
|
+
} else if (relativeStart < 0) {
|
|
984
|
+
k = length + relativeStart > 0 ? length + relativeStart : 0;
|
|
985
|
+
} else {
|
|
986
|
+
k = length < relativeStart ? length : relativeStart;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
let final;
|
|
990
|
+
if (relativeEnd === -Infinity) {
|
|
991
|
+
final = 0;
|
|
992
|
+
} else if (relativeEnd < 0) {
|
|
993
|
+
final = length + relativeEnd > 0 ? length + relativeEnd : 0;
|
|
994
|
+
} else {
|
|
995
|
+
final = length < relativeEnd ? length : relativeEnd;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
const count = final - k > 0 ? final - k : 0;
|
|
999
|
+
const array = new Constructor(count);
|
|
1000
|
+
assertSpeciesTypedArray(array, count);
|
|
1001
|
+
|
|
1002
|
+
if (count === 0) {
|
|
1003
|
+
return array;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
const buffer = TypedArrayPrototypeGetBuffer(float16bitsArray);
|
|
1007
|
+
if (IsDetachedBuffer(buffer)) {
|
|
1008
|
+
throw NativeTypeError(ATTEMPTING_TO_ACCESS_DETACHED_ARRAYBUFFER);
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
let n = 0;
|
|
1012
|
+
while (k < final) {
|
|
1013
|
+
array[n] = convertToNumber(float16bitsArray[k]);
|
|
1014
|
+
++k;
|
|
1015
|
+
++n;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
return /** @type {any} */ (array);
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.subarray */
|
|
1022
|
+
subarray(begin, end) {
|
|
1023
|
+
assertFloat16Array(this);
|
|
1024
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
1025
|
+
|
|
1026
|
+
const Constructor = SpeciesConstructor(float16bitsArray, Float16Array);
|
|
1027
|
+
|
|
1028
|
+
const uint16 = new NativeUint16Array(
|
|
1029
|
+
TypedArrayPrototypeGetBuffer(float16bitsArray),
|
|
1030
|
+
TypedArrayPrototypeGetByteOffset(float16bitsArray),
|
|
1031
|
+
TypedArrayPrototypeGetLength(float16bitsArray)
|
|
1032
|
+
);
|
|
1033
|
+
const uint16Subarray = TypedArrayPrototypeSubarray(uint16, begin, end);
|
|
1034
|
+
|
|
1035
|
+
const array = new Constructor(
|
|
1036
|
+
TypedArrayPrototypeGetBuffer(uint16Subarray),
|
|
1037
|
+
TypedArrayPrototypeGetByteOffset(uint16Subarray),
|
|
1038
|
+
TypedArrayPrototypeGetLength(uint16Subarray)
|
|
1039
|
+
);
|
|
1040
|
+
assertSpeciesTypedArray(array);
|
|
1041
|
+
|
|
1042
|
+
return /** @type {any} */ (array);
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.indexof */
|
|
1046
|
+
indexOf(element, ...opts) {
|
|
1047
|
+
assertFloat16Array(this);
|
|
1048
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
1049
|
+
|
|
1050
|
+
const length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
1051
|
+
|
|
1052
|
+
let from = ToIntegerOrInfinity(opts[0]);
|
|
1053
|
+
if (from === Infinity) {
|
|
1054
|
+
return -1;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
if (from < 0) {
|
|
1058
|
+
from += length;
|
|
1059
|
+
if (from < 0) {
|
|
1060
|
+
from = 0;
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
for (let i = from; i < length; ++i) {
|
|
1065
|
+
if (
|
|
1066
|
+
ObjectHasOwn(float16bitsArray, i) &&
|
|
1067
|
+
convertToNumber(float16bitsArray[i]) === element
|
|
1068
|
+
) {
|
|
1069
|
+
return i;
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
return -1;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.lastindexof */
|
|
1077
|
+
lastIndexOf(element, ...opts) {
|
|
1078
|
+
assertFloat16Array(this);
|
|
1079
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
1080
|
+
|
|
1081
|
+
const length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
1082
|
+
|
|
1083
|
+
let from = opts.length >= 1 ? ToIntegerOrInfinity(opts[0]) : length - 1;
|
|
1084
|
+
if (from === -Infinity) {
|
|
1085
|
+
return -1;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
if (from >= 0) {
|
|
1089
|
+
from = from < length - 1 ? from : length - 1;
|
|
1090
|
+
} else {
|
|
1091
|
+
from += length;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
for (let i = from; i >= 0; --i) {
|
|
1095
|
+
if (
|
|
1096
|
+
ObjectHasOwn(float16bitsArray, i) &&
|
|
1097
|
+
convertToNumber(float16bitsArray[i]) === element
|
|
1098
|
+
) {
|
|
1099
|
+
return i;
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
return -1;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.includes */
|
|
1107
|
+
includes(element, ...opts) {
|
|
1108
|
+
assertFloat16Array(this);
|
|
1109
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
1110
|
+
|
|
1111
|
+
const length = TypedArrayPrototypeGetLength(float16bitsArray);
|
|
1112
|
+
|
|
1113
|
+
let from = ToIntegerOrInfinity(opts[0]);
|
|
1114
|
+
if (from === Infinity) {
|
|
1115
|
+
return false;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
if (from < 0) {
|
|
1119
|
+
from += length;
|
|
1120
|
+
if (from < 0) {
|
|
1121
|
+
from = 0;
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
const isNaN = NumberIsNaN(element);
|
|
1126
|
+
for (let i = from; i < length; ++i) {
|
|
1127
|
+
const value = convertToNumber(float16bitsArray[i]);
|
|
1128
|
+
|
|
1129
|
+
if (isNaN && NumberIsNaN(value)) {
|
|
1130
|
+
return true;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
if (value === element) {
|
|
1134
|
+
return true;
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
return false;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.join */
|
|
1142
|
+
join(separator) {
|
|
1143
|
+
assertFloat16Array(this);
|
|
1144
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
1145
|
+
|
|
1146
|
+
const array = copyToArray(float16bitsArray);
|
|
1147
|
+
|
|
1148
|
+
return ArrayPrototypeJoin(array, separator);
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.tolocalestring */
|
|
1152
|
+
toLocaleString(...opts) {
|
|
1153
|
+
assertFloat16Array(this);
|
|
1154
|
+
const float16bitsArray = getFloat16BitsArray(this);
|
|
1155
|
+
|
|
1156
|
+
const array = copyToArray(float16bitsArray);
|
|
1157
|
+
|
|
1158
|
+
return ArrayPrototypeToLocaleString(array, ...safeIfNeeded(opts));
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
/** @see https://tc39.es/ecma262/#sec-get-%typedarray%.prototype-@@tostringtag */
|
|
1162
|
+
get [SymbolToStringTag]() {
|
|
1163
|
+
if (isFloat16Array(this)) {
|
|
1164
|
+
return /** @type {any} */ ("Float16Array");
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
/** @see https://tc39.es/ecma262/#sec-typedarray.bytes_per_element */
|
|
1170
|
+
ObjectDefineProperty(Float16Array, "BYTES_PER_ELEMENT", {
|
|
1171
|
+
value: BYTES_PER_ELEMENT,
|
|
1172
|
+
});
|
|
1173
|
+
|
|
1174
|
+
// limitation: It is peaked by `Object.getOwnPropertySymbols(Float16Array)` and `Reflect.ownKeys(Float16Array)`
|
|
1175
|
+
ObjectDefineProperty(Float16Array, brand, {});
|
|
1176
|
+
|
|
1177
|
+
/** @see https://tc39.es/ecma262/#sec-properties-of-the-typedarray-constructors */
|
|
1178
|
+
ReflectSetPrototypeOf(Float16Array, TypedArray);
|
|
1179
|
+
|
|
1180
|
+
const Float16ArrayPrototype = Float16Array.prototype;
|
|
1181
|
+
|
|
1182
|
+
/** @see https://tc39.es/ecma262/#sec-typedarray.prototype.bytes_per_element */
|
|
1183
|
+
ObjectDefineProperty(Float16ArrayPrototype, "BYTES_PER_ELEMENT", {
|
|
1184
|
+
value: BYTES_PER_ELEMENT,
|
|
1185
|
+
});
|
|
1186
|
+
|
|
1187
|
+
/** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype-@@iterator */
|
|
1188
|
+
ObjectDefineProperty(Float16ArrayPrototype, SymbolIterator, {
|
|
1189
|
+
value: Float16ArrayPrototype.values,
|
|
1190
|
+
writable: true,
|
|
1191
|
+
configurable: true,
|
|
1192
|
+
});
|
|
1193
|
+
|
|
1194
|
+
ReflectSetPrototypeOf(Float16ArrayPrototype, TypedArrayPrototype);
|