Skip to content

BridgeJS: Fix closures with struct return#739

Open
wfltaylor wants to merge 2 commits intoswiftwasm:mainfrom
wfltaylor:fix-closure-struct-return
Open

BridgeJS: Fix closures with struct return#739
wfltaylor wants to merge 2 commits intoswiftwasm:mainfrom
wfltaylor:fix-closure-struct-return

Conversation

@wfltaylor
Copy link
Copy Markdown
Contributor

Currently, the following code will result in generated code that fails to compile.

@JS public struct Animal {
    public let type: String
}

@JS func roundtripAnimal(_ animalClosure: (Animal) -> Animal) -> (Animal) -> Animal

The generated code uses bridgeJSLiftReturn with no arguments, which doesn’t exist.

This fixes this by adding an overload for bridgeJSLiftReturn which uses the stack ABI.

@wfltaylor
Copy link
Copy Markdown
Contributor Author

@krodak @kateinoigakukun I’ve pushed a semi-related fix which the new tests here surfaced in the generation of the TypeScript type definitions, where Tag was incorrectly emitted as a suffix to the type. Let me know if you want me to split this into a separate PR.

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.

1 participant