tor-browser

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

number.js (1013B)


      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: 12.2.5
      5 description: >
      6    computed property class method names can be a number
      7 includes: [compareArray.js]
      8 ---*/
      9 
     10 function ID(x) {
     11  return x;
     12 }
     13 
     14 class C {
     15  a() { return 'A'; }
     16  [1]() { return 'B'; }
     17  c() { return 'C'; }
     18  [ID(2)]() { return 'D'; }
     19 }
     20 assert.sameValue(new C().a(), 'A', "`new C().a()` returns `'A'`, from `a() { return 'A'; }`");
     21 assert.sameValue(new C()[1](), 'B', "`new C()[1]()` returns `'B'`, from `[1]() { return 'B'; }`");
     22 assert.sameValue(new C().c(), 'C', "`new C().c()` returns `'C'`, from `c() { return 'C'; }`");
     23 assert.sameValue(new C()[2](), 'D', "`new C()[2]()` returns `'D'`, from `[ID(2)]() { return 'D'; }`");
     24 
     25 assert.sameValue(Object.keys(C.prototype).length, 0, "No enum keys from C.prototype");
     26 
     27 assert.compareArray(
     28  Object.getOwnPropertyNames(C.prototype),
     29  ['1', '2', 'constructor', 'a', 'c']
     30 );
     31 
     32 reportCompare(0, 0);