Inferred function name is sometimes confusing
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:

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

Most recent comment there is
This is likely due to how the FunctionNameInferrer in V8 works.
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.
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.
still no progress there, seems it might be not so obvious when they may review that bug again
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.