test262/test/language/statements/generators/yield-spread-arr-multiple.js

43 lines
964 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/declaration.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 (Generator Function declaration)
2017-03-09 16:30:09 +01:00
esid: prod-GeneratorDeclaration
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
GeneratorDeclaration :
function * BindingIdentifier ( 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;
function *gen() {
callCount += 1;
yield [...yield yield];
}
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);