Skip to content

Commit 4d6ff5b

Browse files
committed
fix some comments
1 parent 4fbaf6e commit 4d6ff5b

10 files changed

+52
-27
lines changed

packages/core-js/internals/call-with-safe-iteration-closing.js

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ var iteratorClose = require('../internals/iterator-close');
55
module.exports = function (iterator, fn, value, ENTRIES) {
66
try {
77
return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
8-
// 7.4.6 IteratorClose(iterator, completion)
98
} catch (error) {
109
iteratorClose(iterator);
1110
throw error;

packages/core-js/internals/collection-strong.js

+30-14
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ module.exports = {
7070
};
7171

7272
redefineAll(C.prototype, {
73-
// 23.1.3.1 Map.prototype.clear()
74-
// 23.2.3.2 Set.prototype.clear()
73+
// `{ Map, Set }.prototype.clear()` methods
74+
// https://tc39.es/ecma262/#sec-map.prototype.clear
75+
// https://tc39.es/ecma262/#sec-set.prototype.clear
7576
clear: function clear() {
7677
var that = this;
7778
var state = getInternalState(that);
@@ -87,8 +88,9 @@ module.exports = {
8788
if (DESCRIPTORS) state.size = 0;
8889
else that.size = 0;
8990
},
90-
// 23.1.3.3 Map.prototype.delete(key)
91-
// 23.2.3.4 Set.prototype.delete(value)
91+
// `{ Map, Set }.prototype.delete(key)` methods
92+
// https://tc39.es/ecma262/#sec-map.prototype.delete
93+
// https://tc39.es/ecma262/#sec-set.prototype.delete
9294
'delete': function (key) {
9395
var that = this;
9496
var state = getInternalState(that);
@@ -106,8 +108,9 @@ module.exports = {
106108
else that.size--;
107109
} return !!entry;
108110
},
109-
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
110-
// 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
111+
// `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods
112+
// https://tc39.es/ecma262/#sec-map.prototype.foreach
113+
// https://tc39.es/ecma262/#sec-set.prototype.foreach
111114
forEach: function forEach(callbackfn /* , that = undefined */) {
112115
var state = getInternalState(this);
113116
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
@@ -118,25 +121,29 @@ module.exports = {
118121
while (entry && entry.removed) entry = entry.previous;
119122
}
120123
},
121-
// 23.1.3.7 Map.prototype.has(key)
122-
// 23.2.3.7 Set.prototype.has(value)
124+
// `{ Map, Set}.prototype.has(key)` methods
125+
// https://tc39.es/ecma262/#sec-map.prototype.has
126+
// https://tc39.es/ecma262/#sec-set.prototype.has
123127
has: function has(key) {
124128
return !!getEntry(this, key);
125129
}
126130
});
127131

128132
redefineAll(C.prototype, IS_MAP ? {
129-
// 23.1.3.6 Map.prototype.get(key)
133+
// `Map.prototype.get(key)` method
134+
// https://tc39.es/ecma262/#sec-map.prototype.get
130135
get: function get(key) {
131136
var entry = getEntry(this, key);
132137
return entry && entry.value;
133138
},
134-
// 23.1.3.9 Map.prototype.set(key, value)
139+
// `Map.prototype.set(key, value)` method
140+
// https://tc39.es/ecma262/#sec-map.prototype.set
135141
set: function set(key, value) {
136142
return define(this, key === 0 ? 0 : key, value);
137143
}
138144
} : {
139-
// 23.2.3.1 Set.prototype.add(value)
145+
// `Set.prototype.add(value)` method
146+
// https://tc39.es/ecma262/#sec-set.prototype.add
140147
add: function add(value) {
141148
return define(this, value = value === 0 ? 0 : value, value);
142149
}
@@ -152,8 +159,15 @@ module.exports = {
152159
var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
153160
var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
154161
var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
155-
// add .keys, .values, .entries, [@@iterator]
156-
// 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
162+
// `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods
163+
// https://tc39.es/ecma262/#sec-map.prototype.entries
164+
// https://tc39.es/ecma262/#sec-map.prototype.keys
165+
// https://tc39.es/ecma262/#sec-map.prototype.values
166+
// https://tc39.es/ecma262/#sec-map.prototype-@@iterator
167+
// https://tc39.es/ecma262/#sec-set.prototype.entries
168+
// https://tc39.es/ecma262/#sec-set.prototype.keys
169+
// https://tc39.es/ecma262/#sec-set.prototype.values
170+
// https://tc39.es/ecma262/#sec-set.prototype-@@iterator
157171
defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) {
158172
setInternalState(this, {
159173
type: ITERATOR_NAME,
@@ -180,7 +194,9 @@ module.exports = {
180194
return { value: [entry.key, entry.value], done: false };
181195
}, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
182196

183-
// add [@@species], 23.1.2.2, 23.2.2.2
197+
// `{ Map, Set }.prototype[@@species]` accessors
198+
// https://tc39.es/ecma262/#sec-get-map-@@species
199+
// https://tc39.es/ecma262/#sec-get-set-@@species
184200
setSpecies(CONSTRUCTOR_NAME);
185201
}
186202
};

packages/core-js/internals/collection-weak.js

+12-7
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,19 @@ module.exports = {
7575
};
7676

7777
redefineAll(C.prototype, {
78-
// 23.3.3.2 WeakMap.prototype.delete(key)
79-
// 23.4.3.3 WeakSet.prototype.delete(value)
78+
// { WeakMap, WeakSet }.prototype.delete(key)
79+
// https://tc39.es/ecma262/#sec-weakmap.prototype.delete
80+
// https://tc39.es/ecma262/#sec-weakset.prototype.delete
8081
'delete': function (key) {
8182
var state = getInternalState(this);
8283
if (!isObject(key)) return false;
8384
var data = getWeakData(key);
8485
if (data === true) return uncaughtFrozenStore(state)['delete'](key);
8586
return data && $has(data, state.id) && delete data[state.id];
8687
},
87-
// 23.3.3.4 WeakMap.prototype.has(key)
88-
// 23.4.3.4 WeakSet.prototype.has(value)
88+
// { WeakMap, WeakSet }.prototype.has(key)
89+
// https://tc39.es/ecma262/#sec-weakmap.prototype.has
90+
// https://tc39.es/ecma262/#sec-weakset.prototype.has
8991
has: function has(key) {
9092
var state = getInternalState(this);
9193
if (!isObject(key)) return false;
@@ -96,7 +98,8 @@ module.exports = {
9698
});
9799

98100
redefineAll(C.prototype, IS_MAP ? {
99-
// 23.3.3.3 WeakMap.prototype.get(key)
101+
// WeakMap.prototype.get(key)
102+
// https://tc39.es/ecma262/#sec-weakmap.prototype.get
100103
get: function get(key) {
101104
var state = getInternalState(this);
102105
if (isObject(key)) {
@@ -105,12 +108,14 @@ module.exports = {
105108
return data ? data[state.id] : undefined;
106109
}
107110
},
108-
// 23.3.3.5 WeakMap.prototype.set(key, value)
111+
// WeakMap.prototype.set(key, value)
112+
// https://tc39.es/ecma262/#sec-weakmap.prototype.set
109113
set: function set(key, value) {
110114
return define(this, key, value);
111115
}
112116
} : {
113-
// 23.4.3.1 WeakSet.prototype.add(value)
117+
// WeakSet.prototype.add(value)
118+
// https://tc39.es/ecma262/#sec-weakset.prototype.add
114119
add: function add(value) {
115120
return define(this, value, true);
116121
}

packages/core-js/internals/create-html.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var requireObjectCoercible = require('../internals/require-object-coercible');
22

33
var quot = /"/g;
44

5-
// B.2.3.2.1 CreateHTML(string, tag, attribute, value)
5+
// `CreateHTML` abstract operation
66
// https://tc39.es/ecma262/#sec-createhtml
77
module.exports = function (string, tag, attribute, value) {
88
var S = String(requireObjectCoercible(string));

packages/core-js/internals/date-to-primitive.js

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
var anObject = require('../internals/an-object');
33
var toPrimitive = require('../internals/to-primitive');
44

5+
// `Date.prototype[@@toPrimitive](hint)` method implementation
6+
// https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive
57
module.exports = function (hint) {
68
if (hint !== 'string' && hint !== 'number' && hint !== 'default') {
79
throw TypeError('Incorrect hint');

packages/core-js/internals/define-iterator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, I
6060
}
6161
}
6262

63-
// fix Array#{values, @@iterator}.name in V8 / FF
63+
// fix Array.prototype.{ values, @@iterator }.name in V8 / FF
6464
if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
6565
INCORRECT_VALUES_NAME = true;
6666
defaultIterator = function values() { return nativeIterator.call(this); };

packages/core-js/internals/get-substitution.js

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var replace = ''.replace;
55
var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
66
var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
77

8+
// `GetSubstitution` abstract operation
89
// https://tc39.es/ecma262/#sec-getsubstitution
910
module.exports = function (matched, str, position, captures, namedCaptures, replacement) {
1011
var tailPos = position + matched.length;

packages/core-js/internals/inspect-source.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var store = require('../internals/shared-store');
22

33
var functionToString = Function.toString;
44

5-
// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
5+
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
66
if (typeof store.inspectSource != 'function') {
77
store.inspectSource = function (it) {
88
return functionToString.call(it);

packages/core-js/internals/iterators-core.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function ()
3434

3535
if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
3636

37-
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
37+
// `%IteratorPrototype%[@@iterator]()` method
38+
// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
3839
if ((!IS_PURE || NEW_ITERATOR_PROTOTYPE) && !has(IteratorPrototype, ITERATOR)) {
3940
createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
4041
}

packages/core-js/internals/new-promise-capability.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ var PromiseCapability = function (C) {
1212
this.reject = aFunction(reject);
1313
};
1414

15-
// 25.4.1.5 NewPromiseCapability(C)
15+
// `NewPromiseCapability` abstract operation
16+
// https://tc39.es/ecma262/#sec-newpromisecapability
1617
module.exports.f = function (C) {
1718
return new PromiseCapability(C);
1819
};

0 commit comments

Comments
 (0)