tor-browser

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

regular-subclassing.js (509B)


      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: 19.2.1
      5 description: Subclassing Function
      6 info: |
      7  19.2.1 The Function Constructor
      8 
      9  ...
     10 
     11  The Function constructor is designed to be subclassable. It may be used as the
     12  value of an extends clause of a class definition.
     13  ...
     14 ---*/
     15 
     16 class Fn extends Function {}
     17 
     18 var fn = new Fn('a', 'return a * 2');
     19 
     20 assert.sameValue(fn(42), 84);
     21 
     22 reportCompare(0, 0);