tor-browser

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

fn-name-class.js (924B)


      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: 13.3.1.4
      6 description: Assignment of function `name` attribute (ClassExpression)
      7 info: |
      8    LexicalBinding : BindingIdentifier Initializer
      9 
     10    [...]
     11    6. If IsAnonymousFunctionDefinition(Initializer) is true, then
     12       a. Let hasNameProperty be HasOwnProperty(value, "name").
     13       b. ReturnIfAbrupt(hasNameProperty).
     14       c. If hasNameProperty is false, perform SetFunctionName(value,
     15          bindingId).
     16 includes: [propertyHelper.js]
     17 features: [class]
     18 ---*/
     19 
     20 let xCls = class x {};
     21 let cls = class {};
     22 let xCls2 = class { static name() {} };
     23 
     24 assert.notSameValue(xCls.name, 'xCls');
     25 assert.notSameValue(xCls2.name, 'xCls2');
     26 
     27 verifyProperty(cls, 'name', {
     28  value: 'cls',
     29  writable: false,
     30  enumerable: false,
     31  configurable: true,
     32 });
     33 
     34 reportCompare(0, 0);