tor-browser

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

accessor-name-static-computed-yield-expr.js (1170B)


      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 a YieldExpression within a generator function
      8 info: |
      9  [...]
     10  21. For each ClassElement m in order from methods
     11      a. If IsStatic of m is false, then
     12         [...]
     13      b. Else,
     14         a. Let status be the result of performing PropertyDefinitionEvaluation
     15            for m with arguments F and false.
     16 
     17  ComputedPropertyName : [ AssignmentExpression ]
     18 
     19  1. Let exprValue be the result of evaluating AssignmentExpression.
     20  2. Let propName be ? GetValue(exprValue).
     21  3. Return ? ToPropertyKey(propName).
     22 features: [generators]
     23 ---*/
     24 
     25 var yieldSet, C, iter;
     26 function* g() {
     27  C = class {
     28    static get [yield]() { return 'get yield'; }
     29    static set [yield](param) { yieldSet = param; }
     30  };
     31 }
     32 
     33 iter = g();
     34 
     35 iter.next();
     36 iter.next('first');
     37 iter.next('second');
     38 
     39 assert.sameValue(C.first, 'get yield');
     40 
     41 C.second = 'set yield';
     42 
     43 assert.sameValue(yieldSet, 'set yield');
     44 
     45 reportCompare(0, 0);