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

39 lines
908 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-single.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
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
Array Initializer
SpreadElement[Yield, Await]:
...AssignmentExpression[+In, ?Yield, ?Await]
---*/
var arr = ['a', 'b', 'c'];
var callCount = 0;
2017-03-16 20:54:24 +01:00
var gen = function *g() {
callCount += 1;
yield [...yield];
};
2017-03-09 16:30:09 +01:00
var iter = gen();
iter.next(false);
var item = iter.next(['a', 'b', 'c']);
assert(compareArray(item.value, arr));
assert.sameValue(item.done, false);
assert.sameValue(callCount, 1);