nested-async-gen-await-eval-gtbndng-indirect-update.js (2213B)
1 // |reftest| async 2 // This file was procedurally generated from the following sources: 3 // - src/dynamic-import/eval-gtbndng-indirect-update.case 4 // - src/dynamic-import/default/nested-async-generator-await.template 5 /*--- 6 description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested in async generator, awaited) 7 esid: sec-import-call-runtime-semantics-evaluation 8 features: [dynamic-import, async-iteration] 9 flags: [generated, async] 10 includes: [fnGlobalObject.js] 11 info: | 12 ImportCall : 13 import( AssignmentExpression ) 14 15 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). 16 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). 17 3. Let argRef be the result of evaluating AssignmentExpression. 18 4. Let specifier be ? GetValue(argRef). 19 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). 20 6. Let specifierString be ToString(specifier). 21 7. IfAbruptRejectPromise(specifierString, promiseCapability). 22 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 23 9. Return promiseCapability.[[Promise]]. 24 25 26 GetBindingValue (N, S) 27 28 [...] 29 3. If the binding for N is an indirect binding, then 30 a. Let M and N2 be the indirection values provided when this binding for 31 N was created. 32 b. Let targetEnv be M.[[Environment]]. 33 c. If targetEnv is undefined, throw a ReferenceError exception. 34 d. Let targetER be targetEnv's EnvironmentRecord. 35 e. Return ? targetER.GetBindingValue(N2, S). 36 37 ---*/ 38 39 let callCount = 0; 40 41 async function * f() { 42 await import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { 43 44 assert.sameValue(imported.x, 1); 45 46 // This function is exposed on the global scope (instead of as an exported 47 // binding) in order to avoid possible false positives from assuming correct 48 // behavior of the semantics under test. 49 fnGlobalObject().test262update(); 50 51 assert.sameValue(imported.x, 2); 52 53 54 callCount++; 55 }); 56 } 57 58 f().next().then(() => { 59 assert.sameValue(callCount, 1); 60 }).then($DONE, $DONE).catch($DONE);