tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

super-must-be-called.js (943B)


      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 es6id: 20.3.2
      5 description: Super need to be called to initialize internals
      6 info: |
      7  20.3.2 The Date Constructor
      8 
      9  ...
     10 
     11  The Date constructor is a single function whose behaviour is overloaded based
     12  upon the number and types of its arguments.
     13 
     14  The Date constructor is designed to be subclassable. It may be used as the
     15  value of an extends clause of a class definition. Subclass constructors that
     16  intend to inherit the specified Date behaviour must include a super call to
     17  the Date constructor to create and initialize the subclass instance with a
     18  [[DateValue]] internal slot.
     19 ---*/
     20 
     21 class D extends Date {
     22  constructor() {}
     23 }
     24 
     25 assert.throws(ReferenceError, function() {
     26  new D(0);
     27 });
     28 
     29 class D2 extends Date {
     30  constructor(d) {
     31    super(d);
     32  }
     33 }
     34 
     35 new D2(0);
     36 
     37 reportCompare(0, 0);