Permalink
Browse files

When merging method documentation, section name is also copied if ori…

…ginal name is nil. Closes #199.
  • Loading branch information...
1 parent e203ada commit 53f9aec9d54f1dfc3ed663b31f659d02438242d5 @tomaz committed Mar 8, 2012
Showing with 16 additions and 1 deletion.
  1. +7 −1 Model/GBMethodData.h
  2. +2 −0 Model/GBMethodData.m
  3. +3 −0 Model/GBMethodSectionData.m
  4. +4 −0 Processing/GBProcessor.m
View
@@ -9,7 +9,7 @@
#import "GBModelBase.h"
@class GBMethodArgument;
-
+@class GBMethodSectionData;
/** Defines different method types. */
enum {
@@ -113,6 +113,12 @@ typedef NSUInteger GBMethodType;
*/
@property (readonly) NSString *prefixedMethodSelector;
+/** The section this method belongs to.
+
+ Primarily used so that we can setup proper section name when merging from protocols.
+ */
+@property (retain) GBMethodSectionData *methodSection;
+
///---------------------------------------------------------------------------------------
/// @name Helper properties
///---------------------------------------------------------------------------------------
View
@@ -8,6 +8,7 @@
#import "GRMustache.h"
#import "GBMethodArgument.h"
+#import "GBMethodSectionData.h"
#import "GBMethodData.h"
#import "RegexKitLite.h"
@@ -389,6 +390,7 @@ - (BOOL)isProperty {
@synthesize methodSelectorDelimiter = _methodSelectorDelimiter;
@synthesize methodPrefix = _methodPrefix;
@synthesize prefixedMethodSelector = _prefixedMethodSelector;
+@synthesize methodSection;
@synthesize isRequired;
@end
@@ -6,6 +6,7 @@
// Copyright (C) 2010, Gentle Bytes. All rights reserved.
//
+#import "GBMethodData.h"
#import "GBMethodSectionData.h"
@implementation GBMethodSectionData
@@ -16,11 +17,13 @@ - (void)registerMethod:(GBMethodData *)method {
NSParameterAssert(method != nil);
if (!_methods) _methods = [[NSMutableArray alloc] init];
[_methods addObject:method];
+ method.methodSection = self;
}
- (BOOL)unregisterMethod:(GBMethodData *)method {
if ([_methods containsObject:method]) {
[_methods removeObject:method];
+ method.methodSection = nil;
return YES;
}
return NO;
View
@@ -245,6 +245,10 @@ - (void)copyKnownDocumentationForMethod:(GBMethodData *)method {
GBMethodData *protocolMethod = [protocol.methods methodBySelector:method.methodSelector];
if (protocolMethod.comment) {
GBLogVerbose(@"Copying documentation for %@ from adopted protocol %@...", method, protocol);
+ if (protocolMethod.methodSection.sectionName && !method.methodSection.sectionName) {
+ GBLogDebug(@"Copying section name %@ from %@...", protocolMethod.methodSection.sectionName, protocol);
+ method.methodSection.sectionName = protocolMethod.methodSection.sectionName;
+ }
protocolMethod.comment.originalContext = protocolMethod.parentObject;
method.comment = protocolMethod.comment;
return;

0 comments on commit 53f9aec

Please sign in to comment.