generator-prop-name-yield-id.js (574B)
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 description: > 6 When the `yield` keyword occurs within the PropertyName of a 7 GeneratorMethod outside of a generator function, it behaves as an 8 Identifier. 9 es6id: 14.4 10 features: [generators] 11 flags: [noStrict] 12 ---*/ 13 14 var yield = 'propName'; 15 var obj = { 16 *[yield]() {} 17 }; 18 19 assert( 20 Object.prototype.hasOwnProperty.call(obj, 'propName'), 21 "The property name is taken from the 'yield' variable" 22 ); 23 24 reportCompare(0, 0);