Skip to content

Commit

Permalink
Parsing for objc shortcuts is not less strict. Closes #194.
Browse files Browse the repository at this point in the history
The problem was in appledoc expecting to have either both or neither of variable name and type keywords for a method argument. So this would pass `-(void)method:`, but this not `-(void)method:var`. The fix is simple: just assume the argument is `id`. So later example would transform internally to `-(void)method:(id)var`. Which is probably what Objective C compiler does too.

Have no idea why I didn't think of this before, it's much less restricting (although probably not the recommended way of doing things in ObjC, but that's whole other topic I guess :)
  • Loading branch information
tomaz committed Feb 28, 2012
1 parent 1cff516 commit d0b2c17
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion AppledocTests-Info.plist
Expand Up @@ -17,6 +17,6 @@
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>774</string> <string>775</string>
</dict> </dict>
</plist> </plist>
2 changes: 1 addition & 1 deletion Application/GBApplicationStringsProvider.m
Expand Up @@ -139,7 +139,7 @@ - (NSDictionary *)appledocData {
result = [[NSMutableDictionary alloc] init]; result = [[NSMutableDictionary alloc] init];
[result setObject:@"appledoc" forKey:@"tool"]; [result setObject:@"appledoc" forKey:@"tool"];
[result setObject:@"2.0.5" forKey:@"version"]; [result setObject:@"2.0.5" forKey:@"version"];
[result setObject:@"774" forKey:@"build"]; [result setObject:@"775" forKey:@"build"];
[result setObject:@"http://appledoc.gentlebytes.com" forKey:@"homepage"]; [result setObject:@"http://appledoc.gentlebytes.com" forKey:@"homepage"];
} }
return result; return result;
Expand Down
2 changes: 1 addition & 1 deletion Model/GBMethodArgument.m
Expand Up @@ -26,7 +26,7 @@ + (id)methodArgumentWithName:(NSString *)name {


- (id)initWithName:(NSString *)name types:(NSArray *)types var:(NSString *)var variableArg:(BOOL)variableArg terminationMacros:(NSArray *)macros { - (id)initWithName:(NSString *)name types:(NSArray *)types var:(NSString *)var variableArg:(BOOL)variableArg terminationMacros:(NSArray *)macros {
NSParameterAssert(name != nil); NSParameterAssert(name != nil);
NSParameterAssert(([types count] == 0 && var == nil) || ([types count] > 0 && var != nil)); if ([types count] == 0 && var != nil) types = [NSArray arrayWithObject:@"id"];
self = [super init]; self = [super init];
if (self) { if (self) {
_argumentName = [name copy]; _argumentName = [name copy];
Expand Down

0 comments on commit d0b2c17

Please sign in to comment.