Skip to content

Conversation

@liamappelbe
Copy link
Contributor

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 a BuiltInDeclaration instead 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.

@github-actions
Copy link

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbol Leaking sources
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/jni/lib/src/third_party/generated_bindings.dart
pkgs/objective_c/lib/src/ns_input_stream.dart

@coveralls
Copy link

coveralls commented Aug 20, 2025

Coverage Status

coverage: 81.701% (+0.1%) from 81.584%
when pulling 71b12fd on swift2objc_more_built_ins
into 9d68fa4 on main.

@liamappelbe liamappelbe merged commit 45ee100 into main Aug 21, 2025
17 checks passed
@liamappelbe liamappelbe deleted the swift2objc_more_built_ins branch August 21, 2025 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants