endojs / Jessie

Tiny subset of JavaScript for ocap-safe universal mobile code
Apache License 2.0
279 stars 16 forks source link

fix(eslint-plugin): Handle for-await-of correctly #92

Closed mhofman closed 1 year ago

mhofman commented 1 year ago

According to @erights and @dtribble, an await in the top-level of a for-await-of block is safe since there is always an interleaving point to both enter and exit the block. It's somewhat equivalent to the body of an async function.

While working on this I realized we were not disallowing for-await-of statements where await expressions would be disallowed, so this PR fixes that as well.

Tested manually.

mhofman commented 1 year ago

Feel free to adapt the spirit of these changes if you have a better way of expressing them, but I think it's important to allow nested for-await-ofs, unless there's a reason we shouldn't.

Agreed and I thought that was allowed by this PR. I'll have to double check where things went wrong.

erights commented 1 year ago

What's the status of this? Is it ready to merge? I'm looking forward it, helping reduce the effort to triage await safety. Thanks.

mhofman commented 1 year ago

I need to publish a release.

mhofman commented 1 year ago

I'm looking forward it, helping reduce the effort to triage await safety.

It is now released as of version 0.3.0 of the eslint-plugin.