tor-browser

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

array-elem-init-fn-name-fn.js (1527B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/dstr-assignment/array-elem-init-fn-name-fn.case
      3 // - src/dstr-assignment/default/assignment-expr.template
      4 /*---
      5 description: Assignment of function `name` attribute (FunctionExpression) (AssignmentExpression)
      6 esid: sec-variable-statement-runtime-semantics-evaluation
      7 features: [class, destructuring-binding]
      8 flags: [generated]
      9 includes: [propertyHelper.js]
     10 info: |
     11    VariableDeclaration : BindingPattern Initializer
     12 
     13    1. Let rhs be the result of evaluating Initializer.
     14    2. Let rval be GetValue(rhs).
     15    3. ReturnIfAbrupt(rval).
     16    4. Return the result of performing BindingInitialization for
     17       BindingPattern passing rval and undefined as arguments.
     18 
     19    AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
     20    [...] 7. If Initializer is present and value is undefined and
     21       IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
     22       DestructuringAssignmentTarget are both true, then
     23       a. Let hasNameProperty be HasOwnProperty(v, "name").
     24       b. ReturnIfAbrupt(hasNameProperty).
     25       c. If hasNameProperty is false, perform SetFunctionName(v,
     26          GetReferencedName(lref)).
     27 
     28 ---*/
     29 var xFn, fn;
     30 
     31 var result;
     32 var vals = [];
     33 
     34 result = [ xFn = function x() {}, fn = function() {} ] = vals;
     35 
     36 assert(xFn.name !== 'xFn');
     37 
     38 verifyProperty(fn, 'name', {
     39  enumerable: false,
     40  writable: false,
     41  configurable: true,
     42  value: 'fn'
     43 });
     44 
     45 assert.sameValue(result, vals);
     46 
     47 reportCompare(0, 0);