mirror of
				https://github.com/tc39/test262.git
				synced 2025-10-31 03:34:08 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			43 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| // This file was procedurally generated from the following sources:
 | |
| // - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
 | |
| // - src/dstr-binding/default/async-gen-func-named-expr.template
 | |
| /*---
 | |
| description: RestElement applied to an exhausted iterator (async generator named function expression)
 | |
| esid: sec-asyncgenerator-definitions-evaluation
 | |
| features: [Symbol.iterator, async-iteration]
 | |
| flags: [generated, async]
 | |
| info: |
 | |
|     AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier
 | |
|         ( FormalParameters ) { AsyncGeneratorBody }
 | |
| 
 | |
|         [...]
 | |
|         7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
 | |
|            AsyncGeneratorBody, funcEnv, strict).
 | |
|         [...]
 | |
| 
 | |
| 
 | |
|     13.3.3.6 Runtime Semantics: IteratorBindingInitialization
 | |
|     BindingRestElement : ... BindingIdentifier
 | |
|     1. Let lhs be ResolveBinding(StringValue of BindingIdentifier,
 | |
|        environment).
 | |
|     2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat,
 | |
|        [...]
 | |
|        b. If iteratorRecord.[[done]] is true, then
 | |
|           i. If environment is undefined, return PutValue(lhs, A).
 | |
|           ii. Return InitializeReferencedBinding(lhs, A).
 | |
| 
 | |
| ---*/
 | |
| 
 | |
| 
 | |
| var callCount = 0;
 | |
| var f;
 | |
| f = async function* h([, , ...x]) {
 | |
|   assert(Array.isArray(x));
 | |
|   assert.sameValue(x.length, 0);
 | |
|   callCount = callCount + 1;
 | |
| };
 | |
| 
 | |
| f([1, 2]).next().then(() => {
 | |
|     assert.sameValue(callCount, 1, 'invoked exactly once');
 | |
| }).then($DONE, $DONE);
 |