Skip to content

[ffigen] Switch to named params for ObjC methods #2298

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

liamappelbe
Copy link
Contributor

@liamappelbe liamappelbe commented May 15, 2025

Change the way ObjC methods are generated to use named params, similarly to how ObjC works. Eg dataWithBytes_length_(Pointer<Void> bytes, int length), is now generated as dataWithBytes(Pointer<Void> bytes, {required int length}). This is generally much more readable, but does lead to more method renamings, since the shorter methods names are more likely to collide.

If the named parameter is nullable, it's generated as optional. Protocol method generation hasn't been changed, and are still generated using the long names.

I'll publish ffigen 19 once this lands.

Fixes #1566

@liamappelbe liamappelbe changed the title [ffigen] Switch to named params for ObjC methods WIP: [ffigen] Switch to named params for ObjC methods May 15, 2025
Copy link

github-actions bot commented May 15, 2025

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
objective_c Breaking 7.1.0 8.0.0 8.0.0 ✔️
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 symbols
objective_c _Version

This check can be disabled by tagging the PR with skip-leaking-check.

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
pkgs/objective_c/lib/src/ns_input_stream.dart

All source files should start with a license header.

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

This check can be disabled by tagging the PR with skip-license-check.

@coveralls
Copy link

coveralls commented May 15, 2025

Coverage Status

coverage: 91.735% (+0.04%) from 91.694%
when pulling e4d482a on namedparams
into 5c7152e on main.

@liamappelbe liamappelbe changed the title WIP: [ffigen] Switch to named params for ObjC methods [ffigen] Switch to named params for ObjC methods May 16, 2025
@liamappelbe liamappelbe marked this pull request as ready for review May 16, 2025 01:59
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.

Use named parameters for Obj-C method name translation
3 participants