Skip to content

Commit b12a9cc

Browse files
committed
Merge pull request nygard#50 from mmmulani/master
2 parents 2435447 + 0ee6234 commit b12a9cc

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

Source/CDTextClassDumpVisitor.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#import "CDTextClassDumpVisitor.h"
77

88
#import "CDClassDump.h"
9+
#import "CDType.h"
910
#import "CDOCClass.h"
1011
#import "CDOCCategory.h"
1112
#import "CDOCMethod.h"
@@ -122,8 +123,16 @@ - (void)visitClassMethod:(CDOCMethod *)method;
122123
- (void)visitInstanceMethod:(CDOCMethod *)method propertyState:(CDVisitorPropertyState *)propertyState;
123124
{
124125
CDOCProperty *property = [propertyState propertyForAccessor:method.name];
125-
if (property == nil) {
126+
if (property.isReadOnly && [property.setter isEqualToString:method.name]) {
127+
[self.resultString appendFormat:@"- (void)%@(%@)arg1;\n", method.name, [property.type formattedString:nil formatter:self.classDump.typeController.propertyTypeFormatter level:0]];
128+
} else if (property == nil) {
126129
//NSLog(@"No property for method: %@", method.name);
130+
// C++ destructors can't be called and this header can't be compiled with one declared. So let's comment it out.
131+
// Leave it there so the user knows that the class has a C++ implementation though.
132+
if ([method.name isEqualToString:@".cxx_destruct"]) {
133+
[self.resultString appendString:@"// "];
134+
}
135+
127136
[self.resultString appendString:@"- "];
128137
[method appendToString:self.resultString typeController:self.classDump.typeController];
129138
[self.resultString appendString:@"\n"];

Source/CDType.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,8 @@ - (NSString *)formattedString:(NSString *)previousName formatter:(CDTypeFormatte
437437
result = @"CDUnknownFunctionPointerType";
438438
else
439439
result = [NSString stringWithFormat:@"CDUnknownFunctionPointerType %@", currentName];
440+
result = [NSString stringWithFormat:@"void * /* %@ */", result];
441+
440442
break;
441443

442444
case T_BLOCK_TYPE:
@@ -447,6 +449,7 @@ - (NSString *)formattedString:(NSString *)previousName formatter:(CDTypeFormatte
447449
result = @"CDUnknownBlockType";
448450
else
449451
result = [NSString stringWithFormat:@"CDUnknownBlockType %@", currentName];
452+
result = [NSString stringWithFormat:@"id /* %@ */", result];
450453
}
451454
break;
452455

Source/CDVisitorPropertyState.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ - (id)initWithProperties:(NSArray *)properties;
2828
//NSLog(@"property: %@, getter: %@, setter: %@", [property name], [property getter], [property setter]);
2929
_propertiesByName[property.name] = property;
3030
_propertiesByAccessor[property.getter] = property;
31-
if (property.isReadOnly == NO)
31+
if (property.isReadOnly == NO || property.setter)
3232
_propertiesByAccessor[property.setter] = property;
3333
}
3434
}

0 commit comments

Comments
 (0)