@@ -49,6 +49,7 @@ const {
49
49
} = require ( 'internal/validators' ) ;
50
50
const { previewEntries } = internalBinding ( 'util' ) ;
51
51
const { Buffer : { isBuffer } } = require ( 'buffer' ) ;
52
+ const { assignFunctionName } = require ( 'internal/util' ) ;
52
53
const {
53
54
inspect,
54
55
formatWithOptions,
@@ -172,9 +173,9 @@ const consolePropAttributes = {
172
173
// Fixup global.console instanceof global.console.Console
173
174
ObjectDefineProperty ( Console , SymbolHasInstance , {
174
175
__proto__ : null ,
175
- value ( instance ) {
176
+ value : assignFunctionName ( SymbolHasInstance , function ( instance ) {
176
177
return instance [ kIsConsole ] ;
177
- } ,
178
+ } ) ,
178
179
} ) ;
179
180
180
181
const kColorInspectOptions = { colors : true } ;
@@ -187,19 +188,19 @@ ObjectDefineProperties(Console.prototype, {
187
188
__proto__ : null ,
188
189
...consolePropAttributes ,
189
190
// Eager version for the Console constructor
190
- value : function ( stdout , stderr ) {
191
+ value : assignFunctionName ( kBindStreamsEager , function ( stdout , stderr ) {
191
192
ObjectDefineProperties ( this , {
192
193
'_stdout' : { __proto__ : null , ...consolePropAttributes , value : stdout } ,
193
194
'_stderr' : { __proto__ : null , ...consolePropAttributes , value : stderr } ,
194
195
} ) ;
195
- } ,
196
+ } ) ,
196
197
} ,
197
198
[ kBindStreamsLazy ] : {
198
199
__proto__ : null ,
199
200
...consolePropAttributes ,
200
201
// Lazily load the stdout and stderr from an object so we don't
201
202
// create the stdio streams when they are not even accessed
202
- value : function ( object ) {
203
+ value : assignFunctionName ( kBindStreamsLazy , function ( object ) {
203
204
let stdout ;
204
205
let stderr ;
205
206
ObjectDefineProperties ( this , {
@@ -222,12 +223,12 @@ ObjectDefineProperties(Console.prototype, {
222
223
set ( value ) { stderr = value ; } ,
223
224
} ,
224
225
} ) ;
225
- } ,
226
+ } ) ,
226
227
} ,
227
228
[ kBindProperties ] : {
228
229
__proto__ : null ,
229
230
...consolePropAttributes ,
230
- value : function ( ignoreErrors , colorMode , groupIndentation = 2 ) {
231
+ value : assignFunctionName ( kBindProperties , function ( ignoreErrors , colorMode , groupIndentation = 2 ) {
231
232
ObjectDefineProperties ( this , {
232
233
'_stdoutErrorHandler' : {
233
234
__proto__ : null ,
@@ -262,12 +263,12 @@ ObjectDefineProperties(Console.prototype, {
262
263
value : 'console' ,
263
264
} ,
264
265
} ) ;
265
- } ,
266
+ } ) ,
266
267
} ,
267
268
[ kWriteToConsole ] : {
268
269
__proto__ : null ,
269
270
...consolePropAttributes ,
270
- value : function ( streamSymbol , string ) {
271
+ value : assignFunctionName ( kWriteToConsole , function ( streamSymbol , string ) {
271
272
const ignoreErrors = this . _ignoreErrors ;
272
273
const groupIndent = internalIndentationMap . get ( this ) || '' ;
273
274
@@ -305,12 +306,12 @@ ObjectDefineProperties(Console.prototype, {
305
306
} finally {
306
307
stream . removeListener ( 'error' , noop ) ;
307
308
}
308
- } ,
309
+ } ) ,
309
310
} ,
310
311
[ kGetInspectOptions ] : {
311
312
__proto__ : null ,
312
313
...consolePropAttributes ,
313
- value : function ( stream ) {
314
+ value : assignFunctionName ( kGetInspectOptions , function ( stream ) {
314
315
let color = this [ kColorMode ] ;
315
316
if ( color === 'auto' ) {
316
317
color = lazyUtilColors ( ) . shouldColorize ( stream ) ;
@@ -325,25 +326,25 @@ ObjectDefineProperties(Console.prototype, {
325
326
}
326
327
327
328
return color ? kColorInspectOptions : kNoColorInspectOptions ;
328
- } ,
329
+ } ) ,
329
330
} ,
330
331
[ kFormatForStdout ] : {
331
332
__proto__ : null ,
332
333
...consolePropAttributes ,
333
- value : function ( args ) {
334
+ value : assignFunctionName ( kFormatForStdout , function ( args ) {
334
335
const opts = this [ kGetInspectOptions ] ( this . _stdout ) ;
335
336
ArrayPrototypeUnshift ( args , opts ) ;
336
337
return ReflectApply ( formatWithOptions , null , args ) ;
337
- } ,
338
+ } ) ,
338
339
} ,
339
340
[ kFormatForStderr ] : {
340
341
__proto__ : null ,
341
342
...consolePropAttributes ,
342
- value : function ( args ) {
343
+ value : assignFunctionName ( kFormatForStderr , function ( args ) {
343
344
const opts = this [ kGetInspectOptions ] ( this . _stderr ) ;
344
345
ArrayPrototypeUnshift ( args , opts ) ;
345
346
return ReflectApply ( formatWithOptions , null , args ) ;
346
- } ,
347
+ } ) ,
347
348
} ,
348
349
} ) ;
349
350
0 commit comments