Skip to content
This repository was archived by the owner on Jan 28, 2024. It is now read-only.

Support constructing blocks from closures #382

Merged
merged 2 commits into from
May 25, 2022
Merged

Conversation

liamappelbe
Copy link
Contributor

Register the user's closure in a map, with a unique int ID. Store that ID in the block (in the same target field that the function pointer converter uses). Closures have a separate trampoline function to the function pointer implementation, which uses that ID to look up the closure, then calls it.

As part of dart-lang/native#233, we'll need to remove the closure from the registry when the block is destroyed.

Fixes dart-lang/native#299

@liamappelbe liamappelbe merged commit 23cb986 into master May 25, 2022
@liamappelbe liamappelbe deleted the closure_blocks branch May 25, 2022 16:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

ObjC Block support
2 participants