@@ -51,6 +51,7 @@ const {
5151} = require ( 'internal/validators' ) ;
5252const { previewEntries } = internalBinding ( 'util' ) ;
5353const { Buffer : { isBuffer } } = require ( 'buffer' ) ;
54+ const { assignFunctionName } = require ( 'internal/util' ) ;
5455const {
5556 inspect,
5657 formatWithOptions,
@@ -182,9 +183,9 @@ const consolePropAttributes = {
182183// Fixup global.console instanceof global.console.Console
183184ObjectDefineProperty ( Console , SymbolHasInstance , {
184185 __proto__ : null ,
185- value ( instance ) {
186+ value : assignFunctionName ( SymbolHasInstance , function ( instance ) {
186187 return instance [ kIsConsole ] ;
187- } ,
188+ } ) ,
188189} ) ;
189190
190191const kColorInspectOptions = { colors : true } ;
@@ -197,19 +198,19 @@ ObjectDefineProperties(Console.prototype, {
197198 __proto__ : null ,
198199 ...consolePropAttributes ,
199200 // Eager version for the Console constructor
200- value : function ( stdout , stderr ) {
201+ value : assignFunctionName ( kBindStreamsEager , function ( stdout , stderr ) {
201202 ObjectDefineProperties ( this , {
202203 '_stdout' : { __proto__ : null , ...consolePropAttributes , value : stdout } ,
203204 '_stderr' : { __proto__ : null , ...consolePropAttributes , value : stderr } ,
204205 } ) ;
205- } ,
206+ } ) ,
206207 } ,
207208 [ kBindStreamsLazy ] : {
208209 __proto__ : null ,
209210 ...consolePropAttributes ,
210211 // Lazily load the stdout and stderr from an object so we don't
211212 // create the stdio streams when they are not even accessed
212- value : function ( object ) {
213+ value : assignFunctionName ( kBindStreamsLazy , function ( object ) {
213214 let stdout ;
214215 let stderr ;
215216 ObjectDefineProperties ( this , {
@@ -232,12 +233,12 @@ ObjectDefineProperties(Console.prototype, {
232233 set ( value ) { stderr = value ; } ,
233234 } ,
234235 } ) ;
235- } ,
236+ } ) ,
236237 } ,
237238 [ kBindProperties ] : {
238239 __proto__ : null ,
239240 ...consolePropAttributes ,
240- value : function ( ignoreErrors , colorMode , groupIndentation = 2 ) {
241+ value : assignFunctionName ( kBindProperties , function ( ignoreErrors , colorMode , groupIndentation = 2 ) {
241242 ObjectDefineProperties ( this , {
242243 '_stdoutErrorHandler' : {
243244 __proto__ : null ,
@@ -277,12 +278,12 @@ ObjectDefineProperties(Console.prototype, {
277278 value : 'console' ,
278279 } ,
279280 } ) ;
280- } ,
281+ } ) ,
281282 } ,
282283 [ kWriteToConsole ] : {
283284 __proto__ : null ,
284285 ...consolePropAttributes ,
285- value : function ( streamSymbol , string ) {
286+ value : assignFunctionName ( kWriteToConsole , function ( streamSymbol , string ) {
286287 const ignoreErrors = this . _ignoreErrors ;
287288 const groupIndent = this [ kGroupIndentationString ] ;
288289
@@ -320,12 +321,12 @@ ObjectDefineProperties(Console.prototype, {
320321 } finally {
321322 stream . removeListener ( 'error' , noop ) ;
322323 }
323- } ,
324+ } ) ,
324325 } ,
325326 [ kGetInspectOptions ] : {
326327 __proto__ : null ,
327328 ...consolePropAttributes ,
328- value : function ( stream ) {
329+ value : assignFunctionName ( kGetInspectOptions , function ( stream ) {
329330 let color = this [ kColorMode ] ;
330331 if ( color === 'auto' ) {
331332 color = lazyUtilColors ( ) . shouldColorize ( stream ) ;
@@ -341,12 +342,12 @@ ObjectDefineProperties(Console.prototype, {
341342 }
342343
343344 return color ? kColorInspectOptions : kNoColorInspectOptions ;
344- } ,
345+ } ) ,
345346 } ,
346347 [ kFormatForStdout ] : {
347348 __proto__ : null ,
348349 ...consolePropAttributes ,
349- value : function ( args ) {
350+ value : assignFunctionName ( kFormatForStdout , function ( args ) {
350351 if ( args . length === 1 ) {
351352 // Fast path: single string, don't call format.
352353 // Avoids ReflectApply and validation overhead.
@@ -358,12 +359,12 @@ ObjectDefineProperties(Console.prototype, {
358359 const opts = this [ kGetInspectOptions ] ( this . _stdout ) ;
359360 ArrayPrototypeUnshift ( args , opts ) ;
360361 return ReflectApply ( formatWithOptions , null , args ) ;
361- } ,
362+ } ) ,
362363 } ,
363364 [ kFormatForStderr ] : {
364365 __proto__ : null ,
365366 ...consolePropAttributes ,
366- value : function ( args ) {
367+ value : assignFunctionName ( kFormatForStderr , function ( args ) {
367368 if ( args . length === 1 ) {
368369 // Fast path: single string, don't call format.
369370 // Avoids ReflectApply and validation overhead.
@@ -375,7 +376,7 @@ ObjectDefineProperties(Console.prototype, {
375376 const opts = this [ kGetInspectOptions ] ( this . _stderr ) ;
376377 ArrayPrototypeUnshift ( args , opts ) ;
377378 return ReflectApply ( formatWithOptions , null , args ) ;
378- } ,
379+ } ) ,
379380 } ,
380381} ) ;
381382
0 commit comments