-
Notifications
You must be signed in to change notification settings - Fork 752
Support new.target #193
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Currently on master (e13f095), new.target is not supported.
It will be great to support it in Hermes as some third party dependencies are relying on this internally.
Using Hermes will result in those errors:
Case 1
class CustomError extends Error {
constructor(message) {
super(message); // 'Error' breaks prototype chain here
Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
}
}error: ')' expected at end of function call
Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
~~~~~~~~~~~~~~~~~^
Case 2
class CustomError extends Error {
constructor(message) {
console.log(new.target);
}
}error: invalid statement encountered.
class CustomError extends Error {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Emitted 1 errors. exiting.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working