tor-browser

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

superclass-static-method-override.js (505B)


      1 // Copyright (C) 2014 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 es6id: 14.5
      5 description: >
      6    Static method override
      7 ---*/
      8 function Base() {}
      9 Object.defineProperty(Base, 'staticM', {
     10  set: function() {
     11    throw new Test262Error("`Base.staticM` is unreachable.");
     12  }
     13 });
     14 
     15 class C extends Base {
     16  static staticM() {
     17    return 1;
     18  }
     19 }
     20 
     21 assert.sameValue(C.staticM(), 1, "`C.staticM()` returns `1`");
     22 
     23 reportCompare(0, 0);