[pull] main from swiftwasm:main - #7
Open
pull[bot] wants to merge 1268 commits into
Open
Conversation
- Rename `optionalRepresentation` to `asOptional`. - Remove `undefinedValue` static property and use `.undefined` case directly.
BridgeJS: Update `JSUndefinedOr` APIs
to be consistent with other environment variables used by BridgeJS.
BridgeJS: Include source-context in diagnostic messages
* BridgeJS: Allow executing TS2SwiftVitestTests on Xcode * BridgeJS: Remove parsing API usage from JSSetterMacro * BridgeJS: Remove BasicFormat usage in ExportSwift
NCF: BridgeJS: Generalize Optional stack ABI for Array, Dictionary, and Struct types
…fication NFC: BridgeJS: Delegate nested container codegen to generic runtime conformances
[NFC] BridgeJS: Minimize enum with assoc values code generation
…iftParameter() intrinsics
…tion NFC: BridgeJS: Simplify liftExpression by using no-arg bridgeJSLiftParameter() for enums and protocols
…nches and extracting helpers
NFC: BridgeJS: Simplify ExportSwift codegen by removing redundant branches and extracting helpers
Follow-up to the review on #750: - ImportTS: give the unreachable `.alias` cases in loweringParameterInfo / liftingReturnInfo a message stating the `.unaliased` invariant, so a future change that breaks it fails loudly instead of trapping silently. - JSGlueGen: in `optionalConvention` and `wasmParams`, delegate `.alias` to its underlying type rather than `preconditionFailure()`. These switch on `self` (not `.unaliased`), so this removes a latent crash for alias-wrapped values and matches how abiReturnType / mangleTypeName already handle `.alias`. - SwiftToSkeleton: diagnose `@JS(as:)` combined with `namespace:` instead of silently dropping the namespace; an alias adopts its representation's placement. Adds a diagnostics test. - BridgeJSSkeleton: note why alias mangling uses the (unique) swiftCallName only. - Docs: add an "Exporting a Type With a Custom JS Representation" article and link it from the exporting topics.
BridgeJS: Export types using a separate JS representation
BridgeJS: Fix issues exporting nested types
…oding BridgeJS: Unify optional stack encoding to presence-flag form
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 6 to 7. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](actions/setup-node@v6...v7) --- updated-dependencies: - dependency-name: actions/setup-node dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…rder BridgeJS: Fix argument order for stack-lowered imported parameters
…origins (#795) * BridgeJS: support importing from external ECMAScript modules Extend `from: .module(...)` to accept bare specifiers like `node:path` or an npm package, add `jsName: .default` for default exports, and emit named imports so a wrong export name now fails at module-link time instead of at call time. * BridgeJS: fix named-import regressions found in review Do not require a module export for a wrapper-only `@JSClass`, since a named import is a link-time requirement and nothing looks that name up; accept `jsName: nil` and the explicit `.name(...)` spelling; and validate the tagged `from` form like the plain-string form. * BridgeJS: split snippet and external module import origins Use `from: .snippet("/my-file.js")` for a JavaScript file shipped with the Swift target and `from: .module("node:path")` for an external module, so each keeps its own validation and each mistaken form points at the other. The skeleton encoding is unchanged. * BridgeJS: tag both snippet and module origins in the skeleton Encode `.snippet` as `{"kind":"snippet","path":...}` alongside the existing tagged module form, so the JSON mirrors the Swift cases and a snippet path can no longer encode into a shape that fails to decode.
bridgeJSLowerParameter for structs used toJSObject(), so Swift→JS callbacks discarded the stack and JS lift() read garbage. Match arrays: stack-push on lower, and use the same ABI for ImportTS non-optional structs.
BridgeJS: Unify @js struct parameter lowering onto the stack ABI
BridgeJS: Support generic functions on imported JS APIs
An imported optional whose payload is stack-only ([T]?, [String: V]?, @js struct?) used a hybrid convention: the isSome flag crossed as a wasm i32 parameter while the payload was conditionally pushed onto the shared stacks. Optional returns and optional array elements of the same types already travel entirely on the stacks: payload first, then a 0/1 flag on the i32 stack. This lowers those parameters the same way. The Swift thunk pushes the payload (if some) followed by the flag, the wasm signature carries no argument for the parameter, and the JS handler pops the flag before conditionally lifting the payload, through the same fragment already used for optional returns and elements. The hybrid shape was the last parameter category that both passed a wasm argument and pushed stack data, which is what enabled the argument transposition fixed in #794. Every stack-touching parameter is now flagless and reverse-ordered, matching returns and elements. All other optional parameter ABIs (scalars, strings, JSObject, closures, enums, heap objects) are unchanged.
BridgeJS: Lower imported optional stack parameters fully on the stack
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )