derived-this-uninitialized.js (649B)
1 // Copyright (C) 2016 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget 5 description: > 6 Error when derived constructor does not initialize the `this` binding 7 info: | 8 [...] 9 15. Return ? envRec.GetThisBinding(). 10 11 8.1.1.3.4 GetThisBinding () 12 13 [...] 14 3. If envRec.[[ThisBindingStatus]] is "uninitialized", throw a ReferenceError 15 exception. 16 features: [class] 17 ---*/ 18 19 class C extends Object { 20 constructor() {} 21 } 22 23 assert.throws(ReferenceError, function() { 24 new C(); 25 }); 26 27 reportCompare(0, 0);