Start implementing nominal type resolution for jextract-swift#4
Merged
ktoso merged 6 commits intoSep 27, 2024
Merged
Conversation
Switch the representation of the imported types from a flat list over to a dictionary mapping from the Swift name to the imported type. We need this so that we can find information about the Swift type when it is referenced elsewhere in the syntax tree, such as extensions or uses of that type in other function signatures. While here, stop recording intermediate results within the visitor itself. Instead, keep a reference to the full translator and record results there incrementally. This will become more important when we start handling extensions.
Implement rudimentary name lookup and extension binding for nominal type names so we can resolve Swift type names within a module.
Use the new nominal type resolution functionality within jextract-swift to resolve extensions to their corresponding nominal types, so that members of those extensions show up as member of the resulting Java class.
ktoso
approved these changes
Sep 27, 2024
| _ resolution: NominalTypeResolution, | ||
| name: String, | ||
| fileID: String = #fileID, | ||
| fileParh: String = #filePath, |
Collaborator
There was a problem hiding this comment.
small typo
Suggested change
| fileParh: String = #filePath, | |
| filePath: String = #filePath, |
Collaborator
There was a problem hiding this comment.
Fixing the typo separately :)
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.
Introduce a basic implementation that can resolve the names of nominal types within a given module, including nested types and extensions of types. Use this to enable translating the members of extensions of types into members of the resulting Java class. It will also (eventually) allow us to cross-reference uses of Swift types within other Swift types.