tor-browser

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

fn-name-gen-method.js (1418B)


      1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 es6id: 14.4.13
      6 description: >
      7    Assignment of function `name` attribute (GeneratorMethod)
      8 info: |
      9    GeneratorMethod :
     10        * PropertyName ( StrictFormalParameters ) { GeneratorBody }
     11 
     12    [...]
     13    9. Perform SetFunctionName(closure, propKey).
     14 includes: [propertyHelper.js]
     15 features: [generators, Symbol]
     16 ---*/
     17 
     18 var namedSym = Symbol('test262');
     19 var anonSym = Symbol();
     20 
     21 class A {
     22  *id() {}
     23  *[anonSym]() {}
     24  *[namedSym]() {}
     25  static *id() {}
     26  static *[anonSym]() {}
     27  static *[namedSym]() {}
     28 }
     29 
     30 verifyProperty(A.prototype.id, 'name', {
     31  value: 'id',
     32  writable: false,
     33  enumerable: false,
     34  configurable: true,
     35 });
     36 
     37 verifyProperty(A.prototype[anonSym], 'name', {
     38  value: '',
     39  writable: false,
     40  enumerable: false,
     41  configurable: true,
     42 });
     43 
     44 verifyProperty(A.prototype[namedSym], 'name', {
     45  value: '[test262]',
     46  writable: false,
     47  enumerable: false,
     48  configurable: true,
     49 });
     50 
     51 verifyProperty(A.id, 'name', {
     52  value: 'id',
     53  writable: false,
     54  enumerable: false,
     55  configurable: true,
     56 });
     57 
     58 verifyProperty(A[anonSym], 'name', {
     59  value: '',
     60  writable: false,
     61  enumerable: false,
     62  configurable: true,
     63 });
     64 
     65 verifyProperty(A[namedSym], 'name', {
     66  value: '[test262]',
     67  writable: false,
     68  enumerable: false,
     69  configurable: true,
     70 });
     71 
     72 reportCompare(0, 0);