You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[1.8>1.9] [MERGE #4629@boingoing] OS#15334058: Fix class extends null and this access for super property reference
Merge pull request #4629 from boingoing:ClassExtendsNull
We were supporting some old version of the spec language around classes which extend from null. Instead of leaving `this` undeclared, we were constructing an object and assigning it the `this` binding. This meant we were not throwing ReferenceErrors on access to `this` when we should have been.
Also fixed the case where a super property reference failed to access `this` resulting in trying to load a property from null.
Fixes:
https://microsoft.visualstudio.com/OS/_workitems/edit/15334058
Copy file name to clipboardExpand all lines: test/Basics/SpecialSymbolCapture.js
-25
Original file line number
Diff line number
Diff line change
@@ -516,31 +516,6 @@ var tests = [
516
516
}
517
517
}
518
518
assert.throws(()=>newDerivedSuper(),TypeError,"Class derived from null can't make a super call","Function is not a constructor");
519
-
520
-
classDerivedEmptyextendsnull{
521
-
constructor(){}
522
-
}
523
-
assert.areEqual(DerivedEmpty,newDerivedEmpty().constructor,"Default instance for 'extends null' case is a real instance of the derived class");
524
-
525
-
varcalled=false;
526
-
classDerivedVerifyNewTargetextendsnull{
527
-
constructor(){
528
-
assert.areEqual(DerivedVerifyNewTarget,new.target,"Derived class called as new expression gets new.target");
529
-
called=true;
530
-
}
531
-
}
532
-
assert.areEqual(DerivedVerifyNewTarget,newDerivedVerifyNewTarget().constructor,"Default instance for 'extends null' case is a real instance of the derived class");
533
-
assert.isTrue(called,"Constructor was actually called");
534
-
535
-
called=false;
536
-
classDerivedVerifyThisextendsnull{
537
-
constructor(){
538
-
assert.areEqual(DerivedVerifyThis,this.constructor,"Derived from null class called as new expression gets this instance of the derived class");
539
-
called=true;
540
-
}
541
-
}
542
-
assert.areEqual(DerivedVerifyThis,newDerivedVerifyThis().constructor,"Default instance for 'extends null' case is a real instance of the derived class");
543
-
assert.isTrue(called,"Constructor was actually called");
0 commit comments