[heycam/webidl] Set `[[IsClassConstructor]]` for interfaces without overriden constructor steps (#831)

The `[[IsClassConstructor]]` internal slot is set to `true` for function objects created with the **ES6** `class` keyword.

In interfaces without overriden constructor steps, step 1 ensures that this interface was declared with a `constructor` operation and step 2 ensures that `NewTarget` is not `undefined`.

The `[[IsClassConstructor]]` Function internal slot takes care of step 2 by throwing a `TypeError` at the beginning of the `[[Call]]` internal operation, which is faster, as the `[[Call]]` algorithm only needs to check a boolean internal slot, instead of needing to prepare and push the constructor implementation to the execution context stack.

---

This&nbsp;also&nbsp;means that&nbsp;**WebIDL2JS** isn’t&nbsp;quite&nbsp;spec&nbsp;compliant, as&nbsp;it&nbsp;has&nbsp;<code>[[IsClassConstructor]]&nbsp;===&nbsp;true</code>, whereas&nbsp;native&nbsp;implementations have&nbsp;it&nbsp;currently&nbsp;set&nbsp;to&nbsp;`false`.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/831

Received on Sunday, 12 January 2020 21:50:08 UTC