| // Copyright (C) 2017 the V8 project authors. All rights reserved. |
| // This code is governed by the BSD license found in the LICENSE file. |
| |
| /*--- |
| desc: > |
| Use of yield as a valid identifier in a function body inside a generator body |
| in non strict mode |
| template: non-strict |
| flags: [noStrict] |
| ---*/ |
| |
| //- body |
| return (function(arg) { |
| var yield = arg + 1; |
| return yield; |
| }(yield)) |
| //- assertions |
| var item = iter.next(); |
| |
| assert.sameValue(item.done, false); |
| assert.sameValue(item.value, undefined); |
| |
| item = iter.next(42); |
| |
| assert.sameValue(item.done, true); |
| assert.sameValue(item.value, 43); |