Skip to content

Commit

Permalink
Merge PR nygard#50 from 'mmmulani/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
phatblat committed Nov 24, 2018
2 parents 63ba4c6 + 0ee6234 commit b25203d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
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

0 comments on commit b25203d

Please sign in to comment.