mirror of
https://github.com/tc39/test262.git
synced 2025-07-27 07:54:41 +02:00
Generate tests
This commit is contained in:
parent
2c6a82e55f
commit
70870dc239
@ -0,0 +1,72 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-call-done-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while getting done (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
v. Let done be ? IteratorComplete(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
get done() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,64 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-call-returns-abrupt.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while calling next (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,74 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-call-value-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while getting value (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
vi. If done is true, then
|
||||||
|
1. Return ? IteratorValue(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
done: true,
|
||||||
|
get value() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,64 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while getting next (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
get next() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,84 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-non-object-ignores-then.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: If next() value is not-object, do not access respective then property (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
Number.prototype.then = function() {
|
||||||
|
throw new Test262Error('Number#then should not be used');
|
||||||
|
};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return 42;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, 'TypeError');
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-boolean-throw.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - boolean (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-null-throw.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - null (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-number-throw.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - number (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: 42
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-object-throw.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - object (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-string-throw.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - string (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-symbol-throw.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - symbol (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: Symbol('oi')
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-undefined-throw.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - undefined (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: undefined
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,88 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: Return abrupt after getting next().then (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
10. Get thenAction be then.[[Value]].
|
||||||
|
...
|
||||||
|
12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
|
||||||
|
resolution, thenAction »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
get then() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, 'reject reason');
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-boolean-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (boolean) (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: true,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-null-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (null) (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: null,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-number-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (number) (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: 39,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-object-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (object) (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: {},
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-string-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (string) (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: '',
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-symbol-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (symbol) (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: Symbol('oi'),
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-undefined-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (undefined) (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: undefined,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,88 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-returns-abrupt.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: Return abrupt after calling next().then (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
10. Get thenAction be then.[[Value]].
|
||||||
|
...
|
||||||
|
12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
|
||||||
|
resolution, thenAction »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, 'reject reason');
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,72 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-call-done-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while getting done (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
v. Let done be ? IteratorComplete(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
get done() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,64 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-call-returns-abrupt.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while calling next (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,74 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-call-value-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while getting value (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
vi. If done is true, then
|
||||||
|
1. Return ? IteratorValue(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
done: true,
|
||||||
|
get value() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,64 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while getting next (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
get next() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,84 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-non-object-ignores-then.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: If next() value is not-object, do not access respective then property (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
Number.prototype.then = function() {
|
||||||
|
throw new Test262Error('Number#then should not be used');
|
||||||
|
};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return 42;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, 'TypeError');
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-boolean-throw.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - boolean (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-null-throw.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - null (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-number-throw.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - number (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: 42
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-object-throw.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - object (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-string-throw.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - string (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-symbol-throw.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - symbol (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: Symbol('oi')
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-undefined-throw.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - undefined (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: undefined
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,88 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: Return abrupt after getting next().then (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
10. Get thenAction be then.[[Value]].
|
||||||
|
...
|
||||||
|
12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
|
||||||
|
resolution, thenAction »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
get then() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, 'reject reason');
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-boolean-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (boolean) (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: true,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-null-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (null) (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: null,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-number-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (number) (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: 39,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-object-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (object) (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: {},
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-string-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (string) (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: '',
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-symbol-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (symbol) (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: Symbol('oi'),
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-undefined-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (undefined) (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: undefined,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,88 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-returns-abrupt.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: Return abrupt after calling next().then (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
10. Get thenAction be then.[[Value]].
|
||||||
|
...
|
||||||
|
12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
|
||||||
|
resolution, thenAction »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, 'reject reason');
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,79 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-call-done-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while getting done (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
v. Let done be ? IteratorComplete(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
get done() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,71 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-call-returns-abrupt.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while calling next (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,81 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-call-value-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while getting value (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
vi. If done is true, then
|
||||||
|
1. Return ? IteratorValue(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
done: true,
|
||||||
|
get value() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,71 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while getting next (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
get next() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,91 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-non-object-ignores-then.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: If next() value is not-object, do not access respective then property (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
Number.prototype.then = function() {
|
||||||
|
throw new Test262Error('Number#then should not be used');
|
||||||
|
};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return 42;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, 'TypeError');
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,68 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-boolean-throw.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - boolean (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,68 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-null-throw.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - null (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,68 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-number-throw.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - number (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: 42
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,68 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-object-throw.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - object (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,68 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-string-throw.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - string (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,68 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-symbol-throw.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - symbol (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: Symbol('oi')
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,68 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-undefined-throw.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - undefined (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: undefined
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,95 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: Return abrupt after getting next().then (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
10. Get thenAction be then.[[Value]].
|
||||||
|
...
|
||||||
|
12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
|
||||||
|
resolution, thenAction »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
get then() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, 'reject reason');
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,89 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-boolean-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (boolean) (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: true,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,89 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-null-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (null) (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: null,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,89 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-number-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (number) (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: 39,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,89 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-object-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (object) (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: {},
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,89 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-string-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (string) (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: '',
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,89 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-symbol-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (symbol) (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: Symbol('oi'),
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,89 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-undefined-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (undefined) (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: undefined,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,95 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-returns-abrupt.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: Return abrupt after calling next().then (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
10. Get thenAction be then.[[Value]].
|
||||||
|
...
|
||||||
|
12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
|
||||||
|
resolution, thenAction »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, 'reject reason');
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,79 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-call-done-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while getting done (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
v. Let done be ? IteratorComplete(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
get done() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,71 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-call-returns-abrupt.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while calling next (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,81 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-call-value-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while getting value (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
vi. If done is true, then
|
||||||
|
1. Return ? IteratorValue(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
done: true,
|
||||||
|
get value() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,71 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while getting next (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
get next() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,91 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-non-object-ignores-then.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: If next() value is not-object, do not access respective then property (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
Number.prototype.then = function() {
|
||||||
|
throw new Test262Error('Number#then should not be used');
|
||||||
|
};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return 42;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, 'TypeError');
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,68 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-boolean-throw.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - boolean (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,68 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-null-throw.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - null (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,68 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-number-throw.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - number (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: 42
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,68 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-object-throw.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - object (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,68 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-string-throw.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - string (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,68 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-symbol-throw.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - symbol (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: Symbol('oi')
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,68 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-undefined-throw.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - undefined (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: undefined
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,95 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: Return abrupt after getting next().then (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
10. Get thenAction be then.[[Value]].
|
||||||
|
...
|
||||||
|
12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
|
||||||
|
resolution, thenAction »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
get then() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, 'reject reason');
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,89 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-boolean-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (boolean) (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: true,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,89 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-null-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (null) (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: null,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,89 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-number-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (number) (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: 39,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,89 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-object-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (object) (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: {},
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,89 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-string-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (string) (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: '',
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,89 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-symbol-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (symbol) (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: Symbol('oi'),
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,89 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-undefined-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (undefined) (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: undefined,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,95 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-returns-abrupt.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: Return abrupt after calling next().then (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
10. Get thenAction be then.[[Value]].
|
||||||
|
...
|
||||||
|
12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
|
||||||
|
resolution, thenAction »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, 'reject reason');
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,72 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-call-done-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-obj-method.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while getting done (Async generator method)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
v. Let done be ? IteratorComplete(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
get done() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = {
|
||||||
|
async *method() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}
|
||||||
|
}.method;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,64 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-call-returns-abrupt.case
|
||||||
|
// - src/async-generators/default/async-obj-method.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while calling next (Async generator method)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = {
|
||||||
|
async *method() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}
|
||||||
|
}.method;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,74 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-call-value-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-obj-method.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while getting value (Async generator method)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
vi. If done is true, then
|
||||||
|
1. Return ? IteratorValue(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
done: true,
|
||||||
|
get value() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = {
|
||||||
|
async *method() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}
|
||||||
|
}.method;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,64 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-obj-method.template
|
||||||
|
/*---
|
||||||
|
description: Abrupt completion while getting next (Async generator method)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
get next() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = {
|
||||||
|
async *method() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}
|
||||||
|
}.method;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, "reject reason");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,84 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-non-object-ignores-then.case
|
||||||
|
// - src/async-generators/default/async-obj-method.template
|
||||||
|
/*---
|
||||||
|
description: If next() value is not-object, do not access respective then property (Async generator method)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
Number.prototype.then = function() {
|
||||||
|
throw new Test262Error('Number#then should not be used');
|
||||||
|
};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return 42;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = {
|
||||||
|
async *method() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}
|
||||||
|
}.method;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, 'TypeError');
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-boolean-throw.case
|
||||||
|
// - src/async-generators/default/async-obj-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - boolean (Async generator method)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = {
|
||||||
|
async *method() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}
|
||||||
|
}.method;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-null-throw.case
|
||||||
|
// - src/async-generators/default/async-obj-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - null (Async generator method)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = {
|
||||||
|
async *method() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}
|
||||||
|
}.method;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-number-throw.case
|
||||||
|
// - src/async-generators/default/async-obj-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - number (Async generator method)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: 42
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = {
|
||||||
|
async *method() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}
|
||||||
|
}.method;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-object-throw.case
|
||||||
|
// - src/async-generators/default/async-obj-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - object (Async generator method)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = {
|
||||||
|
async *method() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}
|
||||||
|
}.method;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-string-throw.case
|
||||||
|
// - src/async-generators/default/async-obj-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - string (Async generator method)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = {
|
||||||
|
async *method() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}
|
||||||
|
}.method;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-symbol-throw.case
|
||||||
|
// - src/async-generators/default/async-obj-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - symbol (Async generator method)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: Symbol('oi')
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = {
|
||||||
|
async *method() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}
|
||||||
|
}.method;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-not-callable-undefined-throw.case
|
||||||
|
// - src/async-generators/default/async-obj-method.template
|
||||||
|
/*---
|
||||||
|
description: Not-callable next value in a yield star position - undefined (Async generator method)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next: undefined
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = {
|
||||||
|
async *method() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}
|
||||||
|
}.method;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v.constructor, TypeError, "TypeError");
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,88 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-get-abrupt.case
|
||||||
|
// - src/async-generators/default/async-obj-method.template
|
||||||
|
/*---
|
||||||
|
description: Return abrupt after getting next().then (Async generator method)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
10. Get thenAction be then.[[Value]].
|
||||||
|
...
|
||||||
|
12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
|
||||||
|
resolution, thenAction »).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var reason = {};
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
get then() {
|
||||||
|
throw reason;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = {
|
||||||
|
async *method() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('abrupt completion closes iter');
|
||||||
|
|
||||||
|
}
|
||||||
|
}.method;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(() => {
|
||||||
|
throw new Test262Error('Promise incorrectly fulfilled.');
|
||||||
|
}, v => {
|
||||||
|
assert.sameValue(v, reason, 'reject reason');
|
||||||
|
|
||||||
|
iter.next().then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true, 'the iterator is completed');
|
||||||
|
assert.sameValue(value, undefined, 'value is undefined');
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-boolean-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-obj-method.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (boolean) (Async generator method)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: true,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = {
|
||||||
|
async *method() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
}
|
||||||
|
}.method;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-null-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-obj-method.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (null) (Async generator method)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: null,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = {
|
||||||
|
async *method() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
}
|
||||||
|
}.method;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,82 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-star-next-then-non-callable-number-fulfillpromise.case
|
||||||
|
// - src/async-generators/default/async-obj-method.template
|
||||||
|
/*---
|
||||||
|
description: FulfillPromise if next().then is not-callable (number) (Async generator method)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [Symbol.asyncIterator, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
YieldExpression: yield * AssignmentExpression
|
||||||
|
...
|
||||||
|
6. Repeat
|
||||||
|
a. If received.[[Type]] is normal, then
|
||||||
|
ii. Let innerResult be ? Invoke(iterator, "next",
|
||||||
|
« received.[[Value]] »).
|
||||||
|
iii. If generatorKind is async, then set innerResult to
|
||||||
|
? Await(innerResult).
|
||||||
|
iv. If Type(innerResult) is not Object, throw a TypeError exception.
|
||||||
|
...
|
||||||
|
|
||||||
|
Await
|
||||||
|
|
||||||
|
...
|
||||||
|
2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
|
||||||
|
3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
|
||||||
|
...
|
||||||
|
|
||||||
|
Promise Resolve Functions
|
||||||
|
|
||||||
|
...
|
||||||
|
7. If Type(resolution) is not Object, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
8. Let then be Get(resolution, "then").
|
||||||
|
...
|
||||||
|
11. If IsCallable(thenAction) is false, then
|
||||||
|
a. Return FulfillPromise(promise, resolution).
|
||||||
|
...
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var obj = {
|
||||||
|
get [Symbol.iterator]() {
|
||||||
|
throw new Test262Error('it should not get Symbol.iterator');
|
||||||
|
},
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
return {
|
||||||
|
next() {
|
||||||
|
return {
|
||||||
|
then: 39,
|
||||||
|
value: 42,
|
||||||
|
done: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = {
|
||||||
|
async *method() {
|
||||||
|
callCount += 1;
|
||||||
|
yield* obj;
|
||||||
|
throw new Test262Error('completion closes iter');
|
||||||
|
|
||||||
|
}
|
||||||
|
}.method;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next().then(({ value, done }) => {
|
||||||
|
assert.sameValue(value, 42);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user