Repository navigation
feat: support async exported resource methods - #77
Merged
Merged
Conversation
Dispatch async instance methods with the resource receiver as `this` and resolve async static methods on the exported class.
Merged
malformed-c
added a commit
to apsis-io/dwarf
that referenced
this pull request
Sep 2, 2026
Two things a resource could not do. An async resource method was unreachable. The async export wrapper looked up `func.name().to_lower_camel_case()` on the exports object, and a resource member's WIT name is `[method]counter.bump`, which camel-cases into nothing that exists there - so the lookup failed outright. It now classifies the name the same way the synchronous path does, shifting the receiver off the front of the arguments and binding it as `this`. A constructor is rejected with a clear message rather than a failed lookup: the canonical ABI hands back the handle itself, so there is nothing for a Promise to resolve to. A static method was called with no `this` at all, so one static calling another (`this.parse(...)`, an ordinary thing to write) got undefined. Its class is now bound as the receiver. Ported rather than cherry-picked - upstream's dispatch is built on a refactor dwarf does not share - but dwarf already had the `classify` helper it needed, in wit_imports.rs. The test covers both halves and was checked against the unported runtime, where it fails. Upstream: andreiltd/componentize-qjs#77 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dispatch async instance methods with the resource receiver as
thisand resolve async static methods on the exported class.