Skip to content

Commit cd5a7a0

Browse files
JohnLuck77copybara-github
authored andcommitted
Update TypedArray and DataView externs to support BigInt
PiperOrigin-RevId: 325246846
1 parent 330b35e commit cd5a7a0

File tree

2 files changed

+100
-1
lines changed

2 files changed

+100
-1
lines changed

externs/es6.js

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,71 @@ Float64Array.from = function(source, opt_mapFn, opt_this) {};
992992
Float64Array.of = function(var_args) {};
993993

994994

995+
/**
996+
* @param {number|ArrayBufferView|Array<bigint>|ArrayBuffer|SharedArrayBuffer}
997+
* lengthOrArrayOrBuffer
998+
* @param {number=} byteOffset
999+
* @param {number=} bufferLength
1000+
* @constructor
1001+
* @extends {TypedArray}
1002+
* @throws {Error}
1003+
* @modifies {arguments}
1004+
*/
1005+
function BigInt64Array(lengthOrArrayOrBuffer, byteOffset, bufferLength) {}
1006+
1007+
/** @const {number} */
1008+
BigInt64Array.BYTES_PER_ELEMENT;
1009+
1010+
/**
1011+
* @param {string|!IArrayLike<bigint>|!Iterable<bigint>} source
1012+
* @param {function(this:S, bigint): bigint=} mapFn
1013+
* @param {S=} thisArg
1014+
* @template S
1015+
* @return {!BigInt64Array}
1016+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from
1017+
*/
1018+
BigInt64Array.from = function(source, mapFn, thisArg) {};
1019+
1020+
/**
1021+
* @param {...bigint} var_args
1022+
* @return {!BigInt64Array}
1023+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/of
1024+
*/
1025+
BigInt64Array.of = function(var_args) {};
1026+
1027+
1028+
/**
1029+
* @param {number|ArrayBufferView|Array<bigint>|ArrayBuffer|SharedArrayBuffer}
1030+
* lengthOrArrayOrBuffer
1031+
* @param {number=} byteOffset
1032+
* @param {number=} bufferLength
1033+
* @constructor
1034+
* @extends {TypedArray}
1035+
* @throws {Error}
1036+
* @modifies {arguments}
1037+
*/
1038+
function BigUint64Array(lengthOrArrayOrBuffer, byteOffset, bufferLength) {}
1039+
1040+
/** @const {number} */
1041+
BigUint64Array.BYTES_PER_ELEMENT;
1042+
1043+
/**
1044+
* @param {string|!IArrayLike<bigint>|!Iterable<bigint>} source
1045+
* @param {function(this:S, bigint): bigint=} mapFn
1046+
* @param {S=} thisArg
1047+
* @template S
1048+
* @return {!BigUint64Array}
1049+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from
1050+
*/
1051+
BigUint64Array.from = function(source, mapFn, thisArg) {};
1052+
1053+
/**
1054+
* @param {...bigint} var_args
1055+
* @return {!BigUint64Array}
1056+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/of
1057+
*/
1058+
BigUint64Array.of = function(var_args) {};
1059+
9951060
/**
9961061
* @param {ArrayBuffer|SharedArrayBuffer} buffer
9971062
* @param {number=} opt_byteOffset
@@ -1065,6 +1130,22 @@ DataView.prototype.getFloat32 = function(byteOffset, opt_littleEndian) {};
10651130
*/
10661131
DataView.prototype.getFloat64 = function(byteOffset, opt_littleEndian) {};
10671132

1133+
/**
1134+
* @param {number} byteOffset
1135+
* @param {boolean=} littleEndian
1136+
* @return {bigint}
1137+
* @throws {Error}
1138+
*/
1139+
DataView.prototype.getBigInt64 = function(byteOffset, littleEndian) {};
1140+
1141+
/**
1142+
* @param {number} byteOffset
1143+
* @param {boolean=} littleEndian
1144+
* @return {bigint}
1145+
* @throws {Error}
1146+
*/
1147+
DataView.prototype.getBigUint64 = function(byteOffset, littleEndian) {};
1148+
10681149
/**
10691150
* @param {number} byteOffset
10701151
* @param {number} value
@@ -1137,6 +1218,24 @@ DataView.prototype.setFloat32 = function(
11371218
DataView.prototype.setFloat64 = function(
11381219
byteOffset, value, opt_littleEndian) {};
11391220

1221+
/**
1222+
* @param {number} byteOffset
1223+
* @param {number} value
1224+
* @param {boolean=} littleEndian
1225+
* @throws {Error}
1226+
* @return {undefined}
1227+
*/
1228+
DataView.prototype.setBigInt64 = function(byteOffset, value, littleEndian) {};
1229+
1230+
/**
1231+
* @param {number} byteOffset
1232+
* @param {number} value
1233+
* @param {boolean=} littleEndian
1234+
* @throws {Error}
1235+
* @return {undefined}
1236+
*/
1237+
DataView.prototype.setBigUint64 = function(byteOffset, value, littleEndian) {};
1238+
11401239

11411240
/**
11421241
* @see https://github.com/promises-aplus/promises-spec

src/com/google/javascript/jscomp/resources/resources.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)