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