From c7c767782538243ded64742dca9b34d6af74d62d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 6 Oct 2020 10:18:22 +0200 Subject: fix(core): module execution with top level await (#7672) This commit fixes implementation of top level await in "deno_core". Previously promise returned from module execution was ignored causing to execute modules out-of-order. With this commit promise returned from module execution is stored on "JsRuntime" and event loop is polled until the promise resolves. --- cli/tests/top_level_await_bug_nested.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 cli/tests/top_level_await_bug_nested.js (limited to 'cli/tests/top_level_await_bug_nested.js') diff --git a/cli/tests/top_level_await_bug_nested.js b/cli/tests/top_level_await_bug_nested.js new file mode 100644 index 000000000..894f0de2d --- /dev/null +++ b/cli/tests/top_level_await_bug_nested.js @@ -0,0 +1,5 @@ +const sleep = (n) => new Promise((r) => setTimeout(r, n)); + +await sleep(100); + +export default 1; -- cgit v1.2.3