1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: >
Mixed use of object spread and yield as a valid identifier in a function body
inside a generator body in non strict mode
template: non-strict
info: |
Spread Properties
PropertyDefinition[Yield]:
(...)
...AssignmentExpression[In, ?Yield]
features: [object-spread, Symbol]
flags: [noStrict, async]
---*/
//- setup
var s = Symbol('s');
//- body
yield {
...yield yield,
...(function(arg) {
var yield = arg;
return {...yield};
}(yield)),
...yield,
}
//- assertions
var iter = gen();
iter.next();
iter.next();
iter.next({ x: 10, a: 0, b: 0, [s]: 1 });
iter.next({ y: 20, a: 1, b: 1, [s]: 42 });
var item = iter.next({ z: 30, b: 2 });
item.then(({ done, value }) => {
assert.sameValue(done, false);
assert.sameValue(value.x, 10);
assert.sameValue(value.y, 20);
assert.sameValue(value.z, 30);
assert.sameValue(value.a, 1);
assert.sameValue(value.b, 2);
assert.sameValue(value[s], 42);
assert.sameValue(Object.keys(value).length, 5);
assert(Object.hasOwnProperty.call(value, s));
}).then($DONE, $DONE);
|