From 491fad575c1d33d448ef5f3088c0ec8b2eed1fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Paczy=C5=84ski?= Date: Mon, 20 Jan 2025 15:24:47 +0100 Subject: [PATCH] Add missing composition methods for global Set object in es6_collections externs --- externs/es6_collections.js | 81 ++++++++++++++++++++++++++++++++++---- 1 file changed, 74 insertions(+), 7 deletions(-) diff --git a/externs/es6_collections.js b/externs/es6_collections.js index 93b9264d15a..5f1287f2405 100644 --- a/externs/es6_collections.js +++ b/externs/es6_collections.js @@ -218,7 +218,7 @@ WeakMap.prototype.set = function(key, value) {}; * @implements {Iterable} * @template VALUE * @nosideeffects - * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set + * @see https://tc39.es/ecma262/multipage/keyed-collections.html#sec-set-iterable */ function Set(opt_iterable) {} @@ -227,17 +227,23 @@ function Set(opt_iterable) {} * @return {THIS} * @this {THIS} * @template THIS + * @modifies {this} + * @see https://tc39.es/ecma262/multipage/keyed-collections.html#sec-set.prototype.add */ Set.prototype.add = function(value) {}; /** * @return {void} + * @modifies {this} + * @see https://tc39.es/ecma262/multipage/keyed-collections.html#sec-set.prototype.clear */ Set.prototype.clear = function() {}; /** * @param {VALUE} value * @return {boolean} + * @modifies {this} + * @see https://tc39.es/ecma262/multipage/keyed-collections.html#sec-set.prototype.delete */ Set.prototype.delete = function(value) {}; @@ -245,6 +251,7 @@ Set.prototype.delete = function(value) {}; * @return {!IteratorIterable>} Where each array has two entries: * [value, value] * @nosideeffects + * @see https://tc39.es/ecma262/multipage/keyed-collections.html#sec-set.prototype.values */ Set.prototype.entries = function() {}; @@ -253,6 +260,7 @@ Set.prototype.entries = function() {}; * @param {THIS=} opt_thisArg * @this {SET} * @template SET,THIS + * @see https://tc39.es/ecma262/multipage/keyed-collections.html#sec-set.prototype.foreach */ Set.prototype.forEach = function(callback, opt_thisArg) {}; @@ -260,32 +268,91 @@ Set.prototype.forEach = function(callback, opt_thisArg) {}; * @param {VALUE} value * @return {boolean} * @nosideeffects + * @see https://tc39.es/ecma262/multipage/keyed-collections.html#sec-set.prototype.has */ Set.prototype.has = function(value) {}; -/** - * @type {number} (readonly) - */ -Set.prototype.size; - /** * @return {!IteratorIterable} * @nosideeffects + * @see https://tc39.es/ecma262/multipage/keyed-collections.html#sec-set.prototype.keys */ Set.prototype.keys = function() {}; /** * @return {!IteratorIterable} * @nosideeffects + * @see https://tc39.es/ecma262/multipage/keyed-collections.html#sec-set.prototype.values */ Set.prototype.values = function() {}; +/** + * @param {!Set} other + * @return {!Set} + * @nosideeffects + * @see https://tc39.es/proposal-set-methods/#sec-set.prototype.union + */ +Set.prototype.union = function(other) {}; + +/** + * @param {!Set} other + * @return {!Set} + * @nosideeffects + * @see https://tc39.es/proposal-set-methods/#sec-set.prototype.intersection + */ +Set.prototype.intersection = function(other) {}; + +/** + * @param {!Set} other + * @return {!Set} + * @nosideeffects + * @see https://tc39.es/proposal-set-methods/#sec-set.prototype.difference + */ +Set.prototype.difference = function(other) {}; + +/** + * @param {!Set} other + * @return {!Set} + * @nosideeffects + * @see https://tc39.es/proposal-set-methods/#sec-set.prototype.symmetricdifference + */ +Set.prototype.symmetricDifference = function(other) {}; + +/** + * @param {!Set} other + * @return {boolean} + * @nosideeffects + * @see https://tc39.es/proposal-set-methods/#sec-set.prototype.issupersetof + */ +Set.prototype.isSupersetOf = function(other) {}; + +/** + * @param {!Set} other + * @return {boolean} + * @nosideeffects + * @see https://tc39.es/proposal-set-methods/#sec-set.prototype.issubsetof + */ +Set.prototype.isSubsetOf = function(other) {}; + +/** + * @param {!Set} other + * @return {boolean} + * @nosideeffects + * @see https://tc39.es/proposal-set-methods/#sec-set.prototype.isdisjointfrom + */ +Set.prototype.isDisjointFrom = function(other) {}; + /** * @return {!Iterator} + * @see https://tc39.es/ecma262/multipage/keyed-collections.html#sec-set.prototype-%symbol.iterator% */ Set.prototype[Symbol.iterator] = function() {}; - +/** + * @type {number} (readonly) + * @see https://tc39.es/ecma262/multipage/keyed-collections.html#sec-get-set.prototype.size + */ +Set.prototype.size; /** * @constructor @struct