-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Rust raw identifiers in function names #299
Comments
Notes for anyone that may wish to implement support for this. Implementation GuideBackground ReadingRead the swift-bridge/book/src/contributing/adding-support-for-a-signature/README.md Lines 1 to 216 in 75a1077
Integration TestIn swift-bridge/crates/swift-integration-tests/src/lib.rs Lines 1 to 29 in 637c7b3
Add a bridge module that uses a raw identifier function name: #[swift_bridge::bridge]
mod ffi {
fn r#enum();
} Add a Add an integration test that calls the Codegen TestsAdd a swift-bridge/crates/swift-bridge-ir/src/codegen/codegen_tests.rs Lines 30 to 53 in 636fa27
Add a test case that has a #[swift_bridge::bridge]
mod ffi {
fn r#enum();
} Assert that the generated Swift code uses backticks to escape the name func `enum`() {
} Passing TestsWhen generating the Swift function check if the function name is a Swift keyword (i.e. If so, surround the name with backticks since Swift uses backticks to escape. swift-bridge/crates/swift-bridge-ir/src/codegen/generate_swift/generate_function_swift_calls_rust.rs Line 75 in 1b547a5
Instead of inlining this name generation code in swift-bridge/crates/swift-bridge-ir/src/codegen/generate_swift/generate_function_swift_calls_rust.rs Line 14 in 1b547a5
Here is where the swift-bridge/crates/swift-bridge-ir/src/parsed_extern_fn.rs Lines 39 to 107 in 1b547a5
|
The text was updated successfully, but these errors were encountered: