tor-browser

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

accessor-name-inst-computed-yield-expr.js (1159B)


      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         i. Let status be the result of performing PropertyDefinitionEvaluation
     13            for m with arguments proto and false.
     14 
     15  ComputedPropertyName : [ AssignmentExpression ]
     16 
     17  1. Let exprValue be the result of evaluating AssignmentExpression.
     18  2. Let propName be ? GetValue(exprValue).
     19  3. Return ? ToPropertyKey(propName).
     20 features: [generators]
     21 ---*/
     22 
     23 var yieldSet, C, iter;
     24 function* g() {
     25  class C_ {
     26    get [yield]() { return 'get yield'; }
     27    set [yield](param) { yieldSet = param; }
     28  }
     29 
     30  C = C_;
     31 }
     32 
     33 iter = g();
     34 
     35 iter.next();
     36 iter.next('first');
     37 iter.next('second');
     38 
     39 assert.sameValue(C.prototype.first, 'get yield');
     40 
     41 C.prototype.second = 'set yield';
     42 
     43 assert.sameValue(yieldSet, 'set yield');
     44 
     45 reportCompare(0, 0);