Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/object/method-definition/generator-prop-name-yield-expr.js

raw
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 within a generator function, it behaves as a
8 YieldExpression.
9 es6id: 14.4
10 features: [generators]
11 flags: [noStrict]
12 ---*/
13
14 var obj = null;
15 var yield = 'propNameViaIdentifier';
16 var iter = (function*() {
17 obj = {
18 *[yield]() {}
19 };
20 })();
21
22 iter.next();
23
24 assert.sameValue(obj, null);
25
26 iter.next('propNameViaExpression');
27
28 assert.sameValue(
29 Object.hasOwnProperty.call(obj, 'propNameViaIdentifier'), false
30 );
31 assert.sameValue(
32 Object.hasOwnProperty.call(obj, 'propNameViaExpression'), true
33 );