Debian Codegraph @

js/src/tests/test262/language/module-code/verify-dfs.js

raw
1 // |reftest| module async
2 // Copyright (C) 2020 Ecma International. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 description: Dynamic import can't preempt DFS evaluation order
7 esid: sec-moduleevaluation
8 info: |
9 Evaluate ( ) Concrete Method
10
11 1. Assert: This call to Evaluate is not happening at the same time as another call to Evaluate within the surrounding agent.
12 [...]
13 flags: [module, async]
14 features: [dynamic-import]
15 ---*/
16
17 import './verify-dfs-a_FIXTURE.js';
18 import './verify-dfs-b_FIXTURE.js';
19
20 // rely on function hoisting to create shared array
21 export function evaluated(name) {
22 if (!evaluated.order) {
23 evaluated.order = [];
24 }
25 evaluated.order.push(name);
26 }
27
28 export function check(promise) {
29 promise.then(() => {
30 assert.sameValue(evaluated.order.length, 2);
31 assert.sameValue(evaluated.order[0], 'A');
32 assert.sameValue(evaluated.order[1], 'B');
33 })
34 .then($DONE, $DONE);
35 }