llrt icon indicating copy to clipboard operation
llrt copied to clipboard

top-level await throws SyntaxError

Open teidesu opened this issue 1 year ago • 4 comments

basically the subject

// llrt-test.mjs
function foo() {
  return Promise.resolve(42)
}

console.log(await foo())
$ ./llrt llrt-test.mjs
SyntaxError: unexpected 'await' keyword
    at llrt-test.mjs:5:12

teidesu avatar Feb 12 '24 11:02 teidesu

Thanks for reporting. Top-Level await is not yet supported. It's recently been added to QuickJS so will eventually be supported by LLRT.

richarddavison avatar Feb 12 '24 12:02 richarddavison

Hi, @richarddavison , It seems that rquickjs, which was just released last week, links quickjs with top-level await support. For your information, the latest version is v0.6.1 at this time.

nabetti1720 avatar May 02 '24 22:05 nabetti1720

Hi @nabetti1720 . Thanks for the info, I’m aware and already been working on a PR. This will also introduce ES2023 language support. The blocker I have now is synonymously wait for imports without blocking the async runtime. I have created a PR in rquickjs.

richarddavison avatar May 03 '24 10:05 richarddavison

Hi @richarddavison , This has already been resolved, correct?

nabetti1720 avatar Jun 29 '24 03:06 nabetti1720