mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
The type name is determined by the constructor name of the receiver in a call site. PR-URL: https://github.com/nodejs/node/pull/58976 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
28 lines
464 B
JavaScript
28 lines
464 B
JavaScript
class Foo {
|
|
bar() {
|
|
throw Error('This is a test');
|
|
}
|
|
}
|
|
|
|
class Bar {}
|
|
Bar.prototype.bar = Foo.prototype.bar;
|
|
|
|
try {
|
|
const foo = new Foo();
|
|
foo.bar();
|
|
} catch (e) {
|
|
console.error(e);
|
|
}
|
|
|
|
try {
|
|
const bar = Object.create(Bar.prototype);
|
|
bar.bar();
|
|
} catch (e) {
|
|
console.error(e);
|
|
}
|
|
|
|
// To recreate:
|
|
//
|
|
// cd test/fixtures/source-map
|
|
// npx terser -o throw-class-method.min.js --source-map "url='throw-class-method.min.js.map'" throw-class-method.js
|