Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

BridgeJS: Standardize lift/lower pattern across Swift and JavaScript#423

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
kateinoigakukun merged 8 commits intomainfromyt/doc-bridgejs
Aug 24, 2025

Conversation

@kateinoigakukun
Copy link
Member

Replace global intrinsic functions with consistent extension-based system.
Each bridged type now defines standardized lift/lower operations:

Swift side (type extensions):

  • bridgeJSLowerParameter/Return: Swift -> Wasm core types
  • bridgeJSLiftParameter/Return: Wasm core types -> Swift

JavaScript side (JSGlueGen):

  • Corresponding lift/lower functions for JS <-> Wasm interop

Adds CodeFragmentPrinter for improved code organization.
Reduces generated code complexity across both Swift and JS.

Replace global intrinsic functions with consistent extension-based system.Each bridged type now defines standardized lift/lower operations:Swift side (type extensions):- bridgeJSLowerParameter/Return: Swift -> Wasm core types- bridgeJSLiftParameter/Return: Wasm core types -> SwiftJavaScript side (JSGlueGen):- Corresponding lift/lower functions for JS <-> Wasm interopAdds CodeFragmentPrinter for improved code organization.Reduces generated code complexity across both Swift and JS.
Clean up variable declaration in VariableDeclSyntax visitor.
Introduce _BridgedSwiftTypeLoweredIntoSingleWasmCoreType protocolto formalize lift/lower operations. All basic types (Bool, Int,Float, Double) now conform to this protocol with standardizedbridgeJS* methods.Add _BridgedSwiftHeapObject and _BridgedSwiftEnumNoPayload protocolsfor heap objects and enums respectively.Update generated code and test snapshots to use new protocol-basedintrinsic functions.
…gedClassAdd _JSBridgedClass protocol with lift/lower operations for JavaScriptobjects imported into Swift. Update ImportTS code generation to usenew protocol-based bridgeJS* methods.Update all generated ImportTS Swift files and test snapshots to usethe new bridgeJS* method calls instead of legacy functions.
This is a workaround for the issue that reference to imported bjswasm functions can't be eliminated in debug builds, even if theyare not reachable at runtime without explicit BridgeJS usage.
Copy link

CopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR standardizes the lift/lower pattern across Swift and JavaScript by replacing global intrinsic functions with a consistent extension-based system. The change implements standardized bridge operations for each type, improving code organization and reducing complexity.

  • Introduces a standardized lift/lower protocol system for all bridged types
  • Replaces manual type conversion code with consistentbridgeJSLowerParameter/Return andbridgeJSLiftParameter/Return methods
  • AddsCodeFragmentPrinter for improved JavaScript code generation

Reviewed Changes

Copilot reviewed 51 out of 56 changed files in this pull request and generated 3 comments.

Show a summary per file
FileDescription
Sources/JavaScriptKit/BridgeJSInstrincics.swiftImplements standardized lift/lower extensions for all basic types (Bool, Int, Float, Double, String, JSObject) and bridged types
Sources/JavaScriptKit/JSBridgedType.swiftAdds_JSBridgedClass protocol and updatesJSBridgedClass to inherit from it
Plugins/BridgeJS/Sources/BridgeJSLink/JSGlueGen.swiftNew file implementing JavaScript-side lift/lower operations withIntrinsicJSFragment
Plugins/BridgeJS/Sources/BridgeJSLink/CodeFragmentPrinter.swiftNew utility class for organized code fragment printing
Multiple test snapshotsUpdates generated code to use new standardized bridge methods

Tip: Customize your code reviews with copilot-instructions.md.Create the file orlearn how to get started.

Copy link

CopilotAI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Remove unused _BridgedSwiftTypeLoweredIntoWasmCoreType protocoland fix incomplete documentation comment for the remaining protocol.
@kateinoigakukunkateinoigakukun merged commitcb3ea6c intomainAug 24, 2025
9 checks passed
@kateinoigakukunkateinoigakukun deleted the yt/doc-bridgejs branchAugust 24, 2025 01:28
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@kateinoigakukun

[8]ページ先頭

©2009-2025 Movatter.jp