-
Notifications
You must be signed in to change notification settings - Fork 104
Open
Description
Related to #1314, but this focuses on incorrect code generation for methods.
When importing a JS class as a WIT resource, the generated code in the trampoline appears to be incorrect.
Current generated code:
foo?._isHostProvided = true;
...
await foo(arg);Observation:
- A runtime error occurs when calling the method
- The generated code attempts to call the method as a free function
This suggests the generated code does not preserve the method context (this).
Workaround:
The generate code should call the method on the resource instance instead of treating it as a free function.
let hostProvided = false;
hostProvided = rsc0.constructor._isHostProvided;
...
await rsc0.foo(arg);Full discussion (including context and workaround):
#jco > Unexpected error when using async JS types/functions with im
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels