25
25
const {
26
26
Array,
27
27
ArrayBuffer,
28
+ ArrayBufferPrototype,
29
+ ArrayPrototype,
28
30
ArrayPrototypeForEach,
31
+ ArrayPrototypePush,
29
32
BigInt,
30
33
BigInt64Array,
34
+ BigInt64ArrayPrototype,
35
+ BigIntPrototype,
31
36
BigUint64Array,
37
+ BigUint64ArrayPrototype,
32
38
Boolean,
39
+ BooleanPrototype,
33
40
DataView,
41
+ DataViewPrototype,
34
42
Date,
43
+ DatePrototype,
35
44
Error,
45
+ ErrorPrototype,
36
46
EvalError,
47
+ EvalErrorPrototype,
37
48
Float32Array,
49
+ Float32ArrayPrototype,
38
50
Float64Array,
51
+ Float64ArrayPrototype,
39
52
Function,
53
+ FunctionPrototype,
40
54
Int16Array,
55
+ Int16ArrayPrototype,
41
56
Int32Array,
57
+ Int32ArrayPrototype,
42
58
Int8Array,
43
- JSON ,
59
+ Int8ArrayPrototype ,
44
60
Map,
45
- Math ,
61
+ MapPrototype ,
46
62
Number,
63
+ NumberPrototype,
47
64
Object,
48
65
ObjectDefineProperty,
49
66
ObjectFreeze,
@@ -52,28 +69,44 @@ const {
52
69
ObjectGetOwnPropertyNames,
53
70
ObjectGetOwnPropertySymbols,
54
71
ObjectGetPrototypeOf,
72
+ ObjectPrototype,
55
73
ObjectPrototypeHasOwnProperty,
56
74
Promise,
75
+ PromisePrototype,
57
76
RangeError,
77
+ RangeErrorPrototype,
58
78
ReferenceError,
59
- Reflect ,
79
+ ReferenceErrorPrototype ,
60
80
ReflectOwnKeys,
61
81
RegExp,
82
+ RegExpPrototype,
83
+ SafeSet,
62
84
Set,
85
+ SetPrototype,
63
86
String,
87
+ StringPrototype,
64
88
Symbol,
65
89
SymbolIterator,
66
90
SyntaxError,
91
+ SyntaxErrorPrototype,
67
92
TypeError,
93
+ TypeErrorPrototype,
68
94
TypedArray,
69
95
TypedArrayPrototype,
70
96
Uint16Array,
97
+ Uint16ArrayPrototype,
71
98
Uint32Array,
99
+ Uint32ArrayPrototype,
72
100
Uint8Array,
101
+ Uint8ArrayPrototype,
73
102
Uint8ClampedArray,
103
+ Uint8ClampedArrayPrototype,
74
104
URIError,
105
+ URIErrorPrototype,
75
106
WeakMap,
107
+ WeakMapPrototype,
76
108
WeakSet,
109
+ WeakSetPrototype,
77
110
} = primordials ;
78
111
79
112
module . exports = function ( ) {
@@ -110,55 +143,55 @@ module.exports = function() {
110
143
TypedArrayPrototype ,
111
144
112
145
// 19 Fundamental Objects
113
- Object . prototype , // 19.1
114
- Function . prototype , // 19.2
115
- Boolean . prototype , // 19.3
116
-
117
- Error . prototype , // 19.5
118
- EvalError . prototype ,
119
- RangeError . prototype ,
120
- ReferenceError . prototype ,
121
- SyntaxError . prototype ,
122
- TypeError . prototype ,
123
- URIError . prototype ,
146
+ ObjectPrototype , // 19.1
147
+ FunctionPrototype , // 19.2
148
+ BooleanPrototype , // 19.3
149
+
150
+ ErrorPrototype , // 19.5
151
+ EvalErrorPrototype ,
152
+ RangeErrorPrototype ,
153
+ ReferenceErrorPrototype ,
154
+ SyntaxErrorPrototype ,
155
+ TypeErrorPrototype ,
156
+ URIErrorPrototype ,
124
157
125
158
// 20 Numbers and Dates
126
- Number . prototype , // 20.1
127
- Date . prototype , // 20.3
159
+ NumberPrototype , // 20.1
160
+ DatePrototype , // 20.3
128
161
129
162
// 21 Text Processing
130
- String . prototype , // 21.1
131
- RegExp . prototype , // 21.2
163
+ StringPrototype , // 21.1
164
+ RegExpPrototype , // 21.2
132
165
133
166
// 22 Indexed Collections
134
- Array . prototype , // 22.1
135
-
136
- Int8Array . prototype ,
137
- Uint8Array . prototype ,
138
- Uint8ClampedArray . prototype ,
139
- Int16Array . prototype ,
140
- Uint16Array . prototype ,
141
- Int32Array . prototype ,
142
- Uint32Array . prototype ,
143
- Float32Array . prototype ,
144
- Float64Array . prototype ,
145
- BigInt64Array . prototype ,
146
- BigUint64Array . prototype ,
167
+ ArrayPrototype , // 22.1
168
+
169
+ Int8ArrayPrototype ,
170
+ Uint8ArrayPrototype ,
171
+ Uint8ClampedArrayPrototype ,
172
+ Int16ArrayPrototype ,
173
+ Uint16ArrayPrototype ,
174
+ Int32ArrayPrototype ,
175
+ Uint32ArrayPrototype ,
176
+ Float32ArrayPrototype ,
177
+ Float64ArrayPrototype ,
178
+ BigInt64ArrayPrototype ,
179
+ BigUint64ArrayPrototype ,
147
180
148
181
// 23 Keyed Collections
149
- Map . prototype , // 23.1
150
- Set . prototype , // 23.2
151
- WeakMap . prototype , // 23.3
152
- WeakSet . prototype , // 23.4
182
+ MapPrototype , // 23.1
183
+ SetPrototype , // 23.2
184
+ WeakMapPrototype , // 23.3
185
+ WeakSetPrototype , // 23.4
153
186
154
187
// 24 Structured Data
155
- ArrayBuffer . prototype , // 24.1
156
- DataView . prototype , // 24.3
157
- Promise . prototype , // 25.4
188
+ ArrayBufferPrototype , // 24.1
189
+ DataViewPrototype , // 24.3
190
+ PromisePrototype , // 25.4
158
191
159
192
// Other APIs / Web Compatibility
160
193
console . Console . prototype ,
161
- BigInt . prototype ,
194
+ BigIntPrototype ,
162
195
WebAssembly . Module . prototype ,
163
196
WebAssembly . Instance . prototype ,
164
197
WebAssembly . Table . prototype ,
@@ -171,7 +204,7 @@ module.exports = function() {
171
204
const intrinsics = [
172
205
// Anonymous Intrinsics
173
206
// ThrowTypeError
174
- ObjectGetOwnPropertyDescriptor ( Function . prototype , 'caller' ) . get ,
207
+ ObjectGetOwnPropertyDescriptor ( FunctionPrototype , 'caller' ) . get ,
175
208
// IteratorPrototype
176
209
ObjectGetPrototypeOf (
177
210
ObjectGetPrototypeOf ( new Array ( ) [ SymbolIterator ] ( ) )
@@ -224,6 +257,7 @@ module.exports = function() {
224
257
225
258
// 20 Numbers and Dates
226
259
Number , // 20.1
260
+ // eslint-disable-next-line node-core/prefer-primordials
227
261
Math , // 20.2
228
262
Date , // 20.3
229
263
@@ -255,10 +289,12 @@ module.exports = function() {
255
289
// 24 Structured Data
256
290
ArrayBuffer , // 24.1
257
291
DataView , // 24.3
292
+ // eslint-disable-next-line node-core/prefer-primordials
258
293
JSON , // 24.5
259
294
Promise , // 25.4
260
295
261
296
// 26 Reflection
297
+ // eslint-disable-next-line node-core/prefer-primordials
262
298
Reflect , // 26.1
263
299
Proxy , // 26.2
264
300
@@ -281,19 +317,21 @@ module.exports = function() {
281
317
] ;
282
318
283
319
if ( typeof Intl !== 'undefined' ) {
284
- intrinsicPrototypes . push ( Intl . Collator . prototype ) ;
285
- intrinsicPrototypes . push ( Intl . DateTimeFormat . prototype ) ;
286
- intrinsicPrototypes . push ( Intl . ListFormat . prototype ) ;
287
- intrinsicPrototypes . push ( Intl . NumberFormat . prototype ) ;
288
- intrinsicPrototypes . push ( Intl . PluralRules . prototype ) ;
289
- intrinsicPrototypes . push ( Intl . RelativeTimeFormat . prototype ) ;
290
- intrinsics . push ( Intl ) ;
320
+ ArrayPrototypePush ( intrinsicPrototypes ,
321
+ Intl . Collator . prototype ,
322
+ Intl . DateTimeFormat . prototype ,
323
+ Intl . ListFormat . prototype ,
324
+ Intl . NumberFormat . prototype ,
325
+ Intl . PluralRules . prototype ,
326
+ Intl . RelativeTimeFormat . prototype ,
327
+ ) ;
328
+ ArrayPrototypePush ( intrinsics , Intl ) ;
291
329
}
292
330
293
- intrinsicPrototypes . forEach ( enableDerivedOverrides ) ;
331
+ ArrayPrototypeForEach ( intrinsicPrototypes , enableDerivedOverrides ) ;
294
332
295
333
const frozenSet = new WeakSet ( ) ;
296
- intrinsics . forEach ( deepFreeze ) ;
334
+ ArrayPrototypeForEach ( intrinsics , deepFreeze ) ;
297
335
298
336
// Objects that are deeply frozen.
299
337
function deepFreeze ( root ) {
@@ -306,7 +344,7 @@ module.exports = function() {
306
344
*/
307
345
function innerDeepFreeze ( node ) {
308
346
// Objects that we have frozen in this round.
309
- const freezingSet = new Set ( ) ;
347
+ const freezingSet = new SafeSet ( ) ;
310
348
311
349
// If val is something we should be freezing but aren't yet,
312
350
// add it to freezingSet.
0 commit comments