@@ -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 ) {
186187return 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 ) {
201202ObjectDefineProperties ( 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 ) {
213214let stdout ;
214215let stderr ;
215216ObjectDefineProperties ( this , {
@@ -232,12 +233,12 @@ ObjectDefineProperties(Console.prototype, {
232233set ( 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 ) {
241242ObjectDefineProperties ( this , {
242243'_stdoutErrorHandler' : {
243244__proto__ : null ,
@@ -277,12 +278,12 @@ ObjectDefineProperties(Console.prototype, {
277278value : '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 ) {
286287const ignoreErrors = this . _ignoreErrors ;
287288const groupIndent = this [ kGroupIndentationString ] ;
288289
@@ -320,12 +321,12 @@ ObjectDefineProperties(Console.prototype, {
320321} finally {
321322stream . removeListener ( 'error' , noop ) ;
322323}
323- } ,
324+ } ) ,
324325} ,
325326[ kGetInspectOptions ] : {
326327__proto__ : null ,
327328 ...consolePropAttributes ,
328- value : function ( stream ) {
329+ value : assignFunctionName ( kGetInspectOptions , function ( stream ) {
329330let color = this [ kColorMode ] ;
330331if ( color === 'auto' ) {
331332color = lazyUtilColors ( ) . shouldColorize ( stream ) ;
@@ -341,12 +342,12 @@ ObjectDefineProperties(Console.prototype, {
341342}
342343
343344return color ? kColorInspectOptions : kNoColorInspectOptions ;
344- } ,
345+ } ) ,
345346} ,
346347[ kFormatForStdout ] : {
347348__proto__ : null ,
348349 ...consolePropAttributes ,
349- value : function ( args ) {
350+ value : assignFunctionName ( kFormatForStdout , function ( args ) {
350351if ( 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, {
358359const opts = this [ kGetInspectOptions ] ( this . _stdout ) ;
359360ArrayPrototypeUnshift ( args , opts ) ;
360361return ReflectApply ( formatWithOptions , null , args ) ;
361- } ,
362+ } ) ,
362363} ,
363364[ kFormatForStderr ] : {
364365__proto__ : null ,
365366 ...consolePropAttributes ,
366- value : function ( args ) {
367+ value : assignFunctionName ( kFormatForStderr , function ( args ) {
367368if ( 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, {
375376const opts = this [ kGetInspectOptions ] ( this . _stderr ) ;
376377ArrayPrototypeUnshift ( args , opts ) ;
377378return ReflectApply ( formatWithOptions , null , args ) ;
378- } ,
379+ } ) ,
379380} ,
380381} ) ;
381382
0 commit comments