-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Without it, I think proper subclass emulation is impossible:
const Ctor = function (...args) {
// @jessie.js/eslint-plugin disallows all meta-properties, including `new.target`.
// eslint-disable-next-line no-restricted-syntax
return Reflect.construct(parent, args, new.target ?? Ctor);
};
Object.defineProperty(Ctor, 'name', { value: name });
Object.setPrototypeOf(Ctor, parent);
Object.setPrototypeOf(Ctor.prototype, parent.prototype);However, since Subsetting EcmaScript documents exclusion of Reflect as well, I think that's intentional... such an endowment is of course possible, and such an environment has already accepted the complexity of ECMAScript classes, but it would still be a parsing imposition on all Jessie implementations to allow new at the start of a MemberExpression iff followed by symbols . and target.
And finally, note that even if new.target remains disallowed, the current "'import.meta' is not allowed in Jessie" error message is incorrect so use-jessie-rules.js should be updated regardless, e.g.:
{
selector: `MetaProperty`,
- message: `'import.meta' is ${nono}`,
+ message: `meta-properties like 'import.meta' and 'new.target' are ${nono}`,
},Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels