Skip to content

Conversation

@mschwarzl
Copy link

No description provided.

@mschwarzl mschwarzl mentioned this pull request Sep 9, 2025
@mschwarzl mschwarzl force-pushed the mschwarzl/async-top-level branch from 38c7bee to e9bafb9 Compare September 9, 2025 13:19
Copy link
Collaborator

@Liedtke Liedtke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just leaving a comment. I am not quite sure what the best solution would be to handle top-level await inside modules but a colleague of mine is also looking into module support for Fuzzilli + d8.

throw FuzzilliError.codeVerificationError("operation \(instr.op.name) inside an invalid context")

// allow top-level await
if !(instr.op is Await) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't change that the Await operation will still be marked as requiredContext: [.javascript, .asyncFunction]. If anything, we should remove the .asyncFunction there. However, that would also allow await in synchronous functions etc.

So if we wanted to also allow code generators that emit Await on the top-level, we would need some way to annotate that at least on the code generator. (And furthermore we'd need some notion of whether the top level is a module or not.)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true - I'll investigate this once I have more resources working on that project again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants