test262/test/language/expressions/generators/named-yield-spread-arr-mult...

43 lines
975 B
JavaScript
Raw Normal View History

2017-03-09 16:30:09 +01:00
// This file was procedurally generated from the following sources:
// - src/generators/yield-spread-arr-multiple.case
2017-03-16 20:54:24 +01:00
// - src/generators/default/expression-named.template
2017-03-09 16:30:09 +01:00
/*---
2017-03-16 20:54:24 +01:00
description: Use yield value in a array spread position (Named generator expression)
esid: prod-GeneratorExpression
features: [generators]
2017-03-09 16:30:09 +01:00
flags: [generated]
includes: [compareArray.js]
info: |
14.4 Generator Function Definitions
2017-03-16 20:54:24 +01:00
GeneratorExpression:
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
2017-03-09 16:30:09 +01:00
2017-03-09 16:30:09 +01:00
Array Initializer
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
---*/
var arr = ['a', 'b', 'c'];
var item;
var callCount = 0;
2017-03-16 20:54:24 +01:00
var gen = function *g() {
callCount += 1;
yield [...yield yield];
};
2017-03-09 16:30:09 +01:00
var iter = gen();
iter.next(false);
item = iter.next(['a', 'b', 'c']);
item = iter.next(item.value);
2021-10-01 17:26:44 +02:00
assert.compareArray(item.value, arr);
2017-03-09 16:30:09 +01:00
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);