-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Define ArrayBufferView and TypedArray as interfaces rather than classes #4181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -406,7 +406,8 @@ ArrayBuffer.isView = function(arg) {}; | |
|
||
|
||
/** | ||
* @constructor | ||
* @interface | ||
* @see https://webidl.spec.whatwg.org/#ArrayBufferView | ||
*/ | ||
function ArrayBufferView() {} | ||
|
||
|
@@ -447,12 +448,13 @@ var BufferSource; | |
|
||
|
||
/** | ||
* @constructor | ||
* @interface | ||
* @implements {IArrayLike<number>} | ||
* @implements {Iterable<number>} | ||
* @extends {ArrayBufferView} | ||
* @implements {ArrayBufferView} | ||
* @see https://tc39.es/ecma262/multipage/indexed-collections.html#sec-typedarray-objects | ||
*/ | ||
function TypedArray() {}; | ||
function TypedArray() {} | ||
|
||
/** @const {number} */ | ||
TypedArray.prototype.BYTES_PER_ELEMENT; | ||
|
@@ -730,7 +732,7 @@ TypedArray.prototype[Symbol.iterator] = function() {}; | |
* @param {number=} opt_byteOffset | ||
* @param {number=} opt_length | ||
* @constructor | ||
* @extends {TypedArray} | ||
* @implements {TypedArray} | ||
* @throws {Error} | ||
* @modifies {arguments} If the user passes a backing array, then indexed | ||
* accesses will modify the backing array. JSCompiler does not model | ||
|
@@ -776,7 +778,7 @@ Int8Array.of = function(var_args) {}; | |
* @param {number=} opt_byteOffset | ||
* @param {number=} opt_length | ||
* @constructor | ||
* @extends {TypedArray} | ||
* @implements {TypedArray} | ||
* @throws {Error} | ||
* @modifies {arguments} | ||
*/ | ||
|
@@ -812,7 +814,7 @@ Uint8Array.of = function(var_args) {}; | |
* @param {number=} opt_byteOffset | ||
* @param {number=} opt_length | ||
* @constructor | ||
* @extends {TypedArray} | ||
* @implements {TypedArray} | ||
* @throws {Error} | ||
* @modifies {arguments} | ||
*/ | ||
|
@@ -857,7 +859,7 @@ var CanvasPixelArray; | |
* @param {number=} opt_byteOffset | ||
* @param {number=} opt_length | ||
* @constructor | ||
* @extends {TypedArray} | ||
* @implements {TypedArray} | ||
* @throws {Error} | ||
* @modifies {arguments} | ||
*/ | ||
|
@@ -893,7 +895,7 @@ Int16Array.of = function(var_args) {}; | |
* @param {number=} opt_byteOffset | ||
* @param {number=} opt_length | ||
* @constructor | ||
* @extends {TypedArray} | ||
* @implements {TypedArray} | ||
* @throws {Error} | ||
* @modifies {arguments} | ||
*/ | ||
|
@@ -929,7 +931,7 @@ Uint16Array.of = function(var_args) {}; | |
* @param {number=} opt_byteOffset | ||
* @param {number=} opt_length | ||
* @constructor | ||
* @extends {TypedArray} | ||
* @implements {TypedArray} | ||
* @throws {Error} | ||
* @modifies {arguments} | ||
*/ | ||
|
@@ -965,7 +967,7 @@ Int32Array.of = function(var_args) {}; | |
* @param {number=} opt_byteOffset | ||
* @param {number=} opt_length | ||
* @constructor | ||
* @extends {TypedArray} | ||
* @implements {TypedArray} | ||
* @throws {Error} | ||
* @modifies {arguments} | ||
*/ | ||
|
@@ -1001,7 +1003,7 @@ Uint32Array.of = function(var_args) {}; | |
* @param {number=} opt_byteOffset | ||
* @param {number=} opt_length | ||
* @constructor | ||
* @extends {TypedArray} | ||
* @implements {TypedArray} | ||
* @throws {Error} | ||
* @modifies {arguments} | ||
*/ | ||
|
@@ -1037,7 +1039,7 @@ Float32Array.of = function(var_args) {}; | |
* @param {number=} opt_byteOffset | ||
* @param {number=} opt_length | ||
* @constructor | ||
* @extends {TypedArray} | ||
* @implements {TypedArray} | ||
* @throws {Error} | ||
* @modifies {arguments} | ||
*/ | ||
|
@@ -1073,7 +1075,7 @@ Float64Array.of = function(var_args) {}; | |
* @param {number=} byteOffset | ||
* @param {number=} bufferLength | ||
* @constructor | ||
* @extends {TypedArray} | ||
* @implements {TypedArray} | ||
* @throws {Error} | ||
* @modifies {arguments} | ||
*/ | ||
|
@@ -1109,7 +1111,7 @@ BigInt64Array.of = function(var_args) {}; | |
* @param {number=} byteOffset | ||
* @param {number=} bufferLength | ||
* @constructor | ||
* @extends {TypedArray} | ||
* @implements {TypedArray} | ||
* @throws {Error} | ||
* @modifies {arguments} | ||
*/ | ||
|
@@ -1140,7 +1142,7 @@ BigUint64Array.of = function(var_args) {}; | |
* @param {number=} opt_byteOffset | ||
* @param {number=} opt_byteLength | ||
* @constructor | ||
* @extends {ArrayBufferView} | ||
* @implements {ArrayBufferView} | ||
* @throws {Error} | ||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays/DataView | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and this breaks j2clproto and elemental2 tests, taking a deeper look. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. at first , tests failed
and
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking quickly at the integer_entities (for some related work, to be submitted as a PR soon), I suspect we just need to duplicate the entities found in As an example, for these Uint8Array enjtries:
I think the following integer entities, will resolve most of the above (sorted by the order of the errors above they will resolve, not alphabetical as expected):
This leaves the following, which I don't yet understand:
and this, which I'm not certain will be resolved (but might be, if the union type is inherited correctly):
|
||
|
Uh oh!
There was an error while loading. Please reload this page.