tor-browser

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

accessor-name-computed-yield-id.js (854B)


      1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-object-initializer-runtime-semantics-evaluation
      5 es6id: 12.2.6.8
      6 description: >
      7  The `yield` keyword behaves as an Identifier outside of a generator function
      8 info: |
      9  12.2.6.7 Runtime Semantics: Evaluation
     10 
     11  [...]
     12 
     13  ComputedPropertyName : [ AssignmentExpression ]
     14 
     15  1. Let exprValue be the result of evaluating AssignmentExpression.
     16  2. Let propName be ? GetValue(exprValue).
     17  3. Return ? ToPropertyKey(propName).
     18 flags: [noStrict]
     19 ---*/
     20 
     21 var yield = 'y';
     22 var yieldSet;
     23 var obj = {
     24  get [yield]() { return 'get yield'; },
     25  set [yield](param) { yieldSet = param; }
     26 };
     27 
     28 assert.sameValue(obj.y, 'get yield');
     29 
     30 obj.y = 'set yield';
     31 
     32 assert.sameValue(yieldSet, 'set yield');
     33 
     34 reportCompare(0, 0);