tor-browser

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

fn-name-gen.js (1189B)


      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: 12.2.6.9
      6 description: >
      7    Assignment of function `name` attribute (GeneratorExpression)
      8 info: |
      9    6. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then
     10       a. Let hasNameProperty be HasOwnProperty(propValue, "name").
     11       b. ReturnIfAbrupt(hasNameProperty).
     12       c. If hasNameProperty is false, perform SetFunctionName(propValue,
     13          propKey).
     14 includes: [propertyHelper.js]
     15 features: [generators, Symbol]
     16 ---*/
     17 
     18 var namedSym = Symbol('test262');
     19 var anonSym = Symbol();
     20 var o;
     21 
     22 o = {
     23  xId: function* x() {},
     24  id: function*() {},
     25  [anonSym]: function*() {},
     26  [namedSym]: function*() {}
     27 };
     28 
     29 assert(o.xId.name !== 'xId');
     30 
     31 verifyProperty(o.id, 'name', {
     32  value: 'id',
     33  writable: false,
     34  enumerable: false,
     35  configurable: true,
     36 });
     37 
     38 verifyProperty(o[anonSym], 'name', {
     39  value: '',
     40  writable: false,
     41  enumerable: false,
     42  configurable: true,
     43 });
     44 
     45 verifyProperty(o[namedSym], 'name', {
     46  value: '[test262]',
     47  writable: false,
     48  enumerable: false,
     49  configurable: true,
     50 });
     51 
     52 reportCompare(0, 0);