-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
#781 reverted class extends null {} to the ES2015 semantics and says:
Future work will be done to re-enable the use of a null
extends clause,
but there does not appear to be an issue for that "future work".
The original problem in ES2015 is that new class extends null {} throws because the default constructor that is inserted does a super() call to %FunctionPrototype% which is not a constructor.
The guards in ES2015 to prevent inserting that super() call were wrong and other subsequent attempts to correct that did things that cause other problems (see #781).
I believe there is actually a simple spec. fix for this problem (referencing the ES2015 spec so things don't change out from under. Step 10.a currently is:
a. If ClassHeritageopt is present, then
the fix is:
a. If constructorParent is not the intrinsic object %FunctionPrototype%, then
Previous "fixes" tried to condition the implicit constructor choice on a null superclass value and/or other more global changes to the construction process. The new fix is a localized change that fixes the actual bug: generating a 'super()call to %FunctionPrototype% which we know will fail because it is not a constructor. Also note that the above change is safe because:class extends Function.prototype ()` will independently throw.