name-param-init-yield.js (526B)
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 Initializer of a 7 SingleNameBinding within the FormalParameters of a non-generator 8 MethodDefinition, it behaves as an Identifier. 9 es6id: 14.3 10 flags: [noStrict] 11 ---*/ 12 13 var yield = 'default'; 14 var obj = { 15 method(x = yield) { 16 return x; 17 } 18 }; 19 20 21 assert.sameValue(obj.method(), 'default'); 22 23 reportCompare(0, 0);