diff options
author | Kenta Moriuchi <moriken@kimamass.com> | 2024-04-24 05:54:19 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-23 22:54:19 +0200 |
commit | aff7a64544ee72069049a5429d625b10e4b390a6 (patch) | |
tree | 131db61489f64925daa49dcb6bdf645242e15f79 /ext | |
parent | ae62443ae037cf70eba3770699e82224d064229b (diff) |
fix: Float16Array support (#23512)
Ref #23490, #23277
* remove `--js-float16array` flag (This flag has already added to
deno_core)
* add some `Float16Array` support
Diffstat (limited to 'ext')
-rw-r--r-- | ext/node/polyfills/internal/util/types.ts | 4 | ||||
-rw-r--r-- | ext/web/02_structured_clone.js | 4 | ||||
-rw-r--r-- | ext/web/06_streams.js | 4 | ||||
-rw-r--r-- | ext/webidl/00_webidl.js | 2 |
4 files changed, 12 insertions, 2 deletions
diff --git a/ext/node/polyfills/internal/util/types.ts b/ext/node/polyfills/internal/util/types.ts index 30a25e2e5..b8aca5968 100644 --- a/ext/node/polyfills/internal/util/types.ts +++ b/ext/node/polyfills/internal/util/types.ts @@ -58,6 +58,10 @@ export function isBigUint64Array(value: unknown): value is BigUint64Array { return TypedArrayPrototypeGetSymbolToStringTag(value) === "BigUint64Array"; } +export function isFloat16Array(value: unknown): value is Float16Array { + return TypedArrayPrototypeGetSymbolToStringTag(value) === "Float16Array"; +} + export function isFloat32Array(value: unknown): value is Float32Array { return TypedArrayPrototypeGetSymbolToStringTag(value) === "Float32Array"; } diff --git a/ext/web/02_structured_clone.js b/ext/web/02_structured_clone.js index 84829c313..776a8ee96 100644 --- a/ext/web/02_structured_clone.js +++ b/ext/web/02_structured_clone.js @@ -36,7 +36,6 @@ const { Uint16Array, Uint32Array, BigUint64Array, - Float16Array, Float32Array, Float64Array, } = primordials; @@ -59,7 +58,7 @@ function cloneArrayBuffer( ); } -// TODO(petamoriken): Resizable ArrayBuffer support in the future +// TODO(petamoriken): add Resizable ArrayBuffer support /** Clone a value in a similar way to structured cloning. It is similar to a * StructureDeserialize(StructuredSerialize(...)). */ function structuredClone(value) { @@ -117,6 +116,7 @@ function structuredClone(value) { Constructor = BigUint64Array; break; case "Float16Array": + // TODO(petamoriken): add Float16Array to primordials Constructor = Float16Array; break; case "Float32Array": diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js index cdee1a9dc..e0e3ccbbe 100644 --- a/ext/web/06_streams.js +++ b/ext/web/06_streams.js @@ -1995,6 +1995,10 @@ function readableByteStreamControllerPullInto( case "Uint32Array": ctor = Uint32Array; break; + case "Float16Array": + // TODO(petamoriken): add Float16Array to primordials + ctor = Float16Array; + break; case "Float32Array": ctor = Float32Array; break; diff --git a/ext/webidl/00_webidl.js b/ext/webidl/00_webidl.js index 6cf2c5f8c..6bf6714c6 100644 --- a/ext/webidl/00_webidl.js +++ b/ext/webidl/00_webidl.js @@ -525,6 +525,8 @@ ArrayPrototypeForEach( Uint16Array, Uint32Array, Uint8ClampedArray, + // TODO(petamoriken): add Float16Array converter + // Float16Array, Float32Array, Float64Array, ], |