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

Be able to compile with class-dump headers #50

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Source/CDTextClassDumpVisitor.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#import "CDTextClassDumpVisitor.h"

#import "CDClassDump.h"
#import "CDType.h"
#import "CDOCClass.h"
#import "CDOCCategory.h"
#import "CDOCMethod.h"
Expand Down Expand Up @@ -122,8 +123,16 @@ - (void)visitClassMethod:(CDOCMethod *)method;
- (void)visitInstanceMethod:(CDOCMethod *)method propertyState:(CDVisitorPropertyState *)propertyState;
{
CDOCProperty *property = [propertyState propertyForAccessor:method.name];
if (property == nil) {
if (property.isReadOnly && [property.setter isEqualToString:method.name]) {
[self.resultString appendFormat:@"- (void)%@(%@)arg1;\n", method.name, [property.type formattedString:nil formatter:self.classDump.typeController.propertyTypeFormatter level:0]];
} else if (property == nil) {
//NSLog(@"No property for method: %@", method.name);
// C++ destructors can't be called and this header can't be compiled with one declared. So let's comment it out.
// Leave it there so the user knows that the class has a C++ implementation though.
if ([method.name isEqualToString:@".cxx_destruct"]) {
[self.resultString appendString:@"// "];
}

[self.resultString appendString:@"- "];
[method appendToString:self.resultString typeController:self.classDump.typeController];
[self.resultString appendString:@"\n"];
Expand Down
3 changes: 3 additions & 0 deletions Source/CDType.m
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,8 @@ - (NSString *)formattedString:(NSString *)previousName formatter:(CDTypeFormatte
result = @"CDUnknownFunctionPointerType";
else
result = [NSString stringWithFormat:@"CDUnknownFunctionPointerType %@", currentName];
result = [NSString stringWithFormat:@"void * /* %@ */", result];

break;

case T_BLOCK_TYPE:
Expand All @@ -447,6 +449,7 @@ - (NSString *)formattedString:(NSString *)previousName formatter:(CDTypeFormatte
result = @"CDUnknownBlockType";
else
result = [NSString stringWithFormat:@"CDUnknownBlockType %@", currentName];
result = [NSString stringWithFormat:@"id /* %@ */", result];
}
break;

Expand Down
2 changes: 1 addition & 1 deletion Source/CDVisitorPropertyState.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ - (id)initWithProperties:(NSArray *)properties;
//NSLog(@"property: %@, getter: %@, setter: %@", [property name], [property getter], [property setter]);
_propertiesByName[property.name] = property;
_propertiesByAccessor[property.getter] = property;
if (property.isReadOnly == NO)
if (property.isReadOnly == NO || property.setter)
_propertiesByAccessor[property.setter] = property;
}
}
Expand Down