This repository was archived by the owner on Dec 5, 2019. It is now read-only.
Added @passthrough_property macro to resolve Issue #5 "EXTPassthrough breaks with implicit property synthesis"#48
Open
woolsweater wants to merge 1 commit intojspahrsummers:experimentalfrom
Conversation
Owner
|
Thanks for submitting this! I'm interested to take a look, but libextobjc's experimental branch is honestly kinda low on my list of priorities. I'll try to get around to it eventually. It's certainly awesome to see someone else hacking on it. 🌟 |
Author
|
For sure! Somebody pointed this library out to me a month or two ago, and it seemed like exactly the kind of runtime hacking that I enjoy, so I just looked around for an issue to work on. Hope it fits the bill whenever you get around to reviewing it, but I'm happy to make changes if necessary too. |
… property to a property on another class, along with tests and doc string. This necessitated some small changes to the existing passthrough_ macro; in particular, a SEL_GETTER must be passed in — this is @selector when the method name is specified literally, but sel_getUid() for properties. A property’s accessor methods must be looked up at runtime. The lookup is implemented by two helper functions, which are in EXTRuntimeExtensions This commit is intended to resolve jspahrsummers#5.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The new macro allows forwarding of a specified property to a property on another class. This commit includes tests for the new macro, and a doc string.
This necessitated some small changes to the existing internal
passthrough_macro; in particular, aSEL_GETTERmust be passed in — this is@selector()when the method name is specified literally, butsel_getUid()for properties, because the property’s accessor method names must be looked up at runtime. The lookup is implemented by two helper functions, which are in EXTRuntimeExtensions. I considered macro-generated functions to cache the accessor names, but it seemed more trouble than it was worth.This commit is intended to resolve #5. It does so by inserting an
@dynamicdirective for the named property. This comes with the hitch that both the@propertydeclaration and the@passthrough_propertymust be in the same "segment" of the class definition -- either the same category, or in the main@interface/@implementationblocks.