-
Notifications
You must be signed in to change notification settings - Fork 44
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
[swift2objc] Filtering Support #1730
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you've also got a merge conflict to resolve.
/// | ||
/// APIs can be filtered by name | ||
/// | ||
/// TODO: Add `excludeAll` option to exclude all or include all declarations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's necessary. People can just set filter = (_) => false
.
/// APIs can be filtered by name | ||
/// | ||
/// TODO: Add `excludeAll` option to exclude all or include all declarations | ||
final bool Function(Declaration declaration)? filter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name and documentation don't really make it clear whether this function should return true or false to include the given declaration. Maybe rename it include
or shouldInclude
. Also, make it non-null and then set a default in the constructor.
@@ -43,6 +43,16 @@ ReferredType _parseVariableType( | |||
) { | |||
final subHeadings = propertySymbolJson['names']['subHeading']; | |||
|
|||
// if subheadings have text that contain sets of parentheses and arrows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like closure stuff. Remove it from this PR.
outputFile: Uri.file(actualOutputFile), | ||
tempDir: Directory(thisDir).uri, | ||
preamble: '// Test preamble text', | ||
filter: (declaration) => false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test would be a bit better if you filtered some specific declarations. Try adding a few more classes, methods, globals, top level functions etc, and filter some of them but not all of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, also, can you add a method that is included by the filter, but refers to a class that is not included? What should happen in that case?
This Pull Request is to add filtering support to the swiftgen tool.
Config
More information can be found here: #1394