diff options
author | Leo Kettmeir <crowlkats@toaxl.com> | 2023-01-13 01:48:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-13 01:48:18 +0100 |
commit | f5847a95667aa00caa4956609e2e74fdeadee9d5 (patch) | |
tree | 1c31b1ca74eff05342b86cb9678d6a1ded7ff533 /ext/webgpu/src/01_webgpu.js | |
parent | b4f32c8d14a7d4a274a24f631a84e79e7401ae41 (diff) |
fix(webidl): properly implement setlike (#17363)
Diffstat (limited to 'ext/webgpu/src/01_webgpu.js')
-rw-r--r-- | ext/webgpu/src/01_webgpu.js | 59 |
1 files changed, 7 insertions, 52 deletions
diff --git a/ext/webgpu/src/01_webgpu.js b/ext/webgpu/src/01_webgpu.js index 02bdc6562..792267bda 100644 --- a/ext/webgpu/src/01_webgpu.js +++ b/ext/webgpu/src/01_webgpu.js @@ -34,14 +34,9 @@ SafeArrayIterator, SafePromiseAll, Set, - SetPrototypeEntries, - SetPrototypeForEach, SetPrototypeHas, - SetPrototypeKeys, - SetPrototypeValues, Symbol, SymbolFor, - SymbolIterator, TypeError, Uint32Array, Uint32ArrayPrototype, @@ -602,60 +597,20 @@ function createGPUSupportedFeatures(features) { /** @type {GPUSupportedFeatures} */ - const adapterFeatures = webidl.createBranded(GPUSupportedFeatures); - adapterFeatures[_features] = new Set(features); - return adapterFeatures; + const supportedFeatures = webidl.createBranded(GPUSupportedFeatures); + supportedFeatures[webidl.setlikeInner] = new Set(features); + return webidl.setlike( + supportedFeatures, + GPUSupportedFeaturesPrototype, + true, + ); } class GPUSupportedFeatures { - /** @type {Set<string>} */ - [_features]; - constructor() { webidl.illegalConstructor(); } - /** @return {IterableIterator<[string, string]>} */ - entries() { - webidl.assertBranded(this, GPUSupportedFeaturesPrototype); - return SetPrototypeEntries(this[_features]); - } - - /** @return {void} */ - forEach(callbackfn, thisArg) { - webidl.assertBranded(this, GPUSupportedFeaturesPrototype); - SetPrototypeForEach(this[_features], callbackfn, thisArg); - } - - /** @return {boolean} */ - has(value) { - webidl.assertBranded(this, GPUSupportedFeaturesPrototype); - return SetPrototypeHas(this[_features], value); - } - - /** @return {IterableIterator<string>} */ - keys() { - webidl.assertBranded(this, GPUSupportedFeaturesPrototype); - return SetPrototypeKeys(this[_features]); - } - - /** @return {IterableIterator<string>} */ - values() { - webidl.assertBranded(this, GPUSupportedFeaturesPrototype); - return SetPrototypeValues(this[_features]); - } - - /** @return {number} */ - get size() { - webidl.assertBranded(this, GPUSupportedFeaturesPrototype); - return this[_features].size; - } - - [SymbolIterator]() { - webidl.assertBranded(this, GPUSupportedFeaturesPrototype); - return this[_features][SymbolIterator](); - } - [SymbolFor("Deno.privateCustomInspect")](inspect) { return `${this.constructor.name} ${ inspect([...new SafeArrayIterator(this.values())]) |