-
Notifications
You must be signed in to change notification settings - Fork 226
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
fix class properties by parsing the good tag #285
Conversation
Thanks for investigating this and finding a fix! This will need a bit more work before it can land, though. First, I'd like to see a unit test that covers this change. For example, the existing #pragma mark - Properties
+/// Does this class model musicians?
+@property (class, readwrite, nonatomic) BOOL isMusician;
+
/**
The name of the musician. i.e. "John Coltrane"
*/ By applying this change, I noticed that clang generates 3 declarations when declaring a readwrite property (or 2 if readonly): {
"key.filepath" : "Musician.h",
"key.doc.file" : "Musician.h",
"key.deprecation_message" : "",
"key.always_unavailable" : false,
"key.unavailable_message" : "",
"key.parsed_scope.start" : 17,
"key.kind" : "sourcekitten.source.lang.objc.decl.property",
"key.swift_declaration" : "class var isMusician: Bool { get set }",
"key.doc.full_as_xml" : "",
"key.always_deprecated" : false,
"key.doc.line" : 17,
"key.doc.column" : 46,
"key.name" : "isMusician",
"key.doc.comment" : "Always returns `YES`.",
"key.usr" : "c:objc(cs)JAZMusician(cpy)isMusician",
"key.parsed_declaration" : "@property (assign, readwrite, nonatomic, class) BOOL isMusician;",
"key.parsed_scope.end" : 17
},
{
"key.filepath" : "Musician.h",
"key.doc.file" : "Musician.h",
"key.deprecation_message" : "",
"key.always_unavailable" : false,
"key.unavailable_message" : "",
"key.parsed_scope.start" : 17,
"key.kind" : "sourcekitten.source.lang.objc.decl.method.class",
"key.always_deprecated" : false,
"key.doc.line" : 17,
"key.doc.column" : 46,
"key.name" : "+isMusician",
"key.usr" : "c:objc(cs)JAZMusician(cm)isMusician",
"key.parsed_declaration" : "+ (BOOL)isMusician;",
"key.parsed_scope.end" : 17
},
{
"key.filepath" : "Musician.h",
"key.doc.file" : "Musician.h",
"key.deprecation_message" : "",
"key.always_unavailable" : false,
"key.unavailable_message" : "",
"key.parsed_scope.start" : 17,
"key.kind" : "sourcekitten.source.lang.objc.decl.method.class",
"key.always_deprecated" : false,
"key.doc.line" : 17,
"key.doc.column" : 46,
"key.name" : "+setIsMusician:",
"key.usr" : "c:objc(cs)JAZMusician(cm)setIsMusician:",
"key.parsed_declaration" : "+ (void)setIsMusician:(BOOL)isMusician;",
"key.parsed_scope.end" : 17
} So that's the property, along with getter and setter methods. For instance properties, we reject implicitly generated property getters & setters (see Sequence.rejectPropertyMethods()). However, because
I've pushed up my partial work to address these issues in 6499d8b, but that could certainly be improved by some refactoring. @jeremiegirault if you're up for it, I'll let you continue your work in this PR to address the points I've brought up. Thanks again for the contribution. |
I'll look at this. |
Let me know if you have any questions or would like any help. |
sure ! |
your fix looks good, just rebased your master and updated some fixtures to have tests passing, is it good ? |
Looks like you made some changes to account for Xcode 8.1 and Swift 3.0.1, but since the unit tests still run on 8.0 on Travis, they're now failing. |
ok then I'll revert this |
done |
Thanks for your hard work on this @jeremiegirault! Will merge in #291. |
haha it was mostly your work @jpsim but thank you :) |
handles #243
I don't know how sourcekitten works so this must be a dirty patch, but I had to fix it quickly to make jazzy work for me.
Better solutions are welcome but it's working (not crashing at least) and is a good starting point.