[swift2objc] More built in declarations #2518
Merged
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.
I'm working on a PR that adds all the Apple Foundation symbols to all swift2objc parses. This is a self-contained part of that change that expands the number of built in toll-free bridging types we support.
First, fix a bug in parse_symbols_map.dart, skipping parsing for any symbols we've already seen. Otherwise when parsing Foundation we overwrite a lot of the built in declarations.
Next, I noticed a lot of the IDs in Foundation start with
c:objc(cs), and AFAICT these are all toll-free bridging types. So I added a special case in the parser that detects these objects and returns aBuiltInDeclarationinstead of actually trying to parse the object. This avoids generating a lot of unnecessary wrappers.Finally, I parsed all of Foundation, and printed out all the IDs of this form, then hard coded them in the built in list. This significantly speeds up and simplifies parsing of Foundation, and also means that we can get pretty far without even needing to parse Foundation. I'm currently testing whether this change makes swift2objc powerful enough for MVP without the need for the bigger change that this PR was peeled off of.