Skip to content
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

[ffigen] Experiment to remove synth blocks #1869

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

liamappelbe
Copy link
Contributor

@liamappelbe liamappelbe commented Jan 7, 2025

Missing features:

  • Constructing blocks from function pointers instead of closures
  • Unregistering block closures when the block is destroyed
  • One of the blocking block tests is deadlocking

Copy link

github-actions bot commented Jan 7, 2025

PR Health

Breaking changes ⚠️
Package Change Current Version New Version Needed Version Looking good?
objective_c Breaking 4.0.0 4.1.0-wip 5.0.0
Got "4.1.0-wip" expected >= "5.0.0" (breaking changes)
⚠️

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

Changelog Entry
Package Changed Files
package:objective_c pkgs/objective_c/lib/src/c_bindings_generated.dart
pkgs/objective_c/lib/src/internal.dart
pkgs/objective_c/lib/src/objective_c_bindings_generated.dart

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

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

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 ObjCBlockBase
c._ObjCBlockImpl
_ObjCBlockRef
_ObjCObject
_Dart_FinalizableHandle
_ObjCProtocol
_ObjCSelector
_ObjCMethodDesc
_ObjCObjectRef
_NSZone

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

@@ -308,44 +311,46 @@ abstract final class $name {
s.write('}\n\n');

// Call operator extension method.
s.write('''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I need to be able to call blocks e.g.

      ncb.NSURLSessionDataDelegate
          .URLSession_dataTask_didReceiveResponse_completionHandler_
          .implementAsListener(protoBuilder,
              (nsSession, nsDataTask, nsResponse, nsCompletionHandler) {
        final exactResponse = URLResponse._exactURLResponseType(nsResponse);
        final disposition = onResponse(
            URLSession._(nsSession,
                isBackground: isBackground, hasDelegate: true),
            URLSessionTask._(nsDataTask),
            exactResponse);
        nsCompletionHandler.call(disposition);
      });

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated code also seems to have some issues:
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some other code gen issues like:

Try importing the library that defines 'registerBlockClosure', correcting the name to the name of an existing function, or defining a function named 'registerBlockClosure'.dart[undefined_function](https://dart.dev/diagnostics/undefined_function)```

Copy link
Contributor Author

@liamappelbe liamappelbe Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brianquinlan Those errors look like you're not using the version of package:objective_c from this branch. Might need a dependency override with a path dep.

I'll work on supporting the call operator today.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added support for the call operator

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.

2 participants