Skip to content

Commit 390fffc

Browse files
JohnLuck77copybara-github
authored andcommitted
Replace ad hoc externs with BigInt support in official externs
PiperOrigin-RevId: 325017679
1 parent acc4f4f commit 390fffc

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

externs/es3.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,68 @@ Number.NEGATIVE_INFINITY;
10281028
*/
10291029
Number.POSITIVE_INFINITY;
10301030

1031+
/**
1032+
* @constructor
1033+
* @param {number|string|bigint} arg
1034+
* @return {bigint}
1035+
* @nosideeffects
1036+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
1037+
*/
1038+
function BigInt(arg) {}
1039+
1040+
/**
1041+
* Wraps a BigInt value to a signed integer between -2^(width-1) and
1042+
* 2^(width-1)-1.
1043+
* @param {number} width
1044+
* @param {bigint} bigint
1045+
* @return {bigint}
1046+
* @nosideeffects
1047+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt/asIntN
1048+
*/
1049+
BigInt.asIntN = function(width, bigint) {};
1050+
1051+
/**
1052+
* Wraps a BigInt value to an unsigned integer between 0 and (2^width)-1.
1053+
* @param {number} width
1054+
* @param {bigint} bigint
1055+
* @return {bigint}
1056+
* @nosideeffects
1057+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt/asUintN
1058+
*/
1059+
BigInt.asUintN = function(width, bigint) {};
1060+
1061+
/**
1062+
* Returns a string with a language-sensitive representation of this BigInt.
1063+
* @param {string|!Array<string>=} locales
1064+
* @param {Object=} options
1065+
* @return {string}
1066+
* @nosideeffects
1067+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt/toLocaleString
1068+
* @override
1069+
*/
1070+
BigInt.prototype.toLocaleString = function(locales, options) {};
1071+
1072+
/**
1073+
* Returns a string representing the specified BigInt object. The trailing "n"
1074+
* is not part of the string.
1075+
* @this {BigInt|bigint}
1076+
* @param {number=} radix
1077+
* @return {string}
1078+
* @nosideeffects
1079+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt/toString
1080+
* @override
1081+
*/
1082+
BigInt.prototype.toString = function(radix) {};
1083+
1084+
/**
1085+
* Returns the wrapped primitive value of a BigInt object.
1086+
* @return {bigint}
1087+
* @nosideeffects
1088+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt/valueOf
1089+
* @override
1090+
*/
1091+
BigInt.prototype.valueOf = function() {};
1092+
10311093

10321094
/**
10331095
* @const

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)