diagnostics icon indicating copy to clipboard operation
diagnostics copied to clipboard

Inferred function name is sometimes confusing

Open wentout opened this issue 3 years ago • 1 comments

Hi!

This issue is just cross-linking with Chromium bugs. IDK if this is needed. Just if it will be solved we may additionally add this to the change log history. And if they need some help with research it will be nice from us.

https://bugs.chromium.org/p/chromium/issues/detail?id=1354147


const MethodName = 'MyMethodName';

var NamingObject = {
	[MethodName]: function () {
		this;
		console.log(this.constructor.name); // MyMethodName
		debugger;
	}
};

debugger;

const zzz = NamingObject[MethodName];
console.log('zzz: ', zzz.name); // MyMethodName

const sss = new zzz();
const xxx = new NamingObject[MethodName]();

// both lines below will use
// 'MyMethodName' as an ouput for Console
// but using Chrome DevTools it will instead
// bring NamingObject as a referer

console.log(sss);
console.log(xxx);

// and using Firefox we will see just Object here
// using just Object keeps less disambiguation
debugger;

So using Node.js console.log here we will see the following:

image

Though using Chrome Dev Tools we will see NamingObject instead of MethodName :

image

Most recent comment there is

This is likely due to how the FunctionNameInferrer in V8 works.

wentout avatar Aug 20 '22 14:08 wentout

Answering the "Question" label...

This Issue made mainly just for keeping track with progress there. As when resolved we may add Change Log record.

However if somebody can help to identify where exactly V8 or Chrome Dev Tools stores that buggy behavior -- it seems to be great help. Also here we have everything necessary for reviewing that bug.

wentout avatar Sep 02 '22 09:09 wentout

This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.

github-actions[bot] avatar Dec 05 '22 00:12 github-actions[bot]

still no progress there, seems it might be not so obvious when they may review that bug again

wentout avatar Dec 09 '22 13:12 wentout

This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.

github-actions[bot] avatar Mar 10 '23 00:03 github-actions[bot]