Skip to content

Commit 9844fee

Browse files
committed
Merge pull request onevcat#84 from Garnel/master
fixed bug onevcat#83
2 parents 9090cc3 + 63779c4 commit 9844fee

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

VVDocumenter-Xcode/OCCategory/NSString+VVSyntax/NSString+VVSyntax.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ -(BOOL) vv_isSwiftEnum
8181

8282
-(BOOL) vv_isSwiftProperty
8383
{
84-
return [self vv_matchesPatternRegexPattern:@"^\\s*(.*?)(\\s*let|var\\s*)\\s+"];
84+
// `let`/`var` can be in swift func, but `(` appear before `let`/`var` only
85+
// happens when `private(set)` or `internal(set)` is used
86+
return [self vv_matchesPatternRegexPattern:@"^\\s*([^(]*?)(((\\s*let|var\\s*)\\s+)|(\\(\\s*set\\s*\\)))"];
8587
}
8688

8789
@end

VVDocumenterTests/DocumenterTests/VVMethodTestsCode.plist

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,21 @@ SIAlertViewBackgroundStyleSolid,
429429
</array>
430430
<key>vv_isSwiftFunction</key>
431431
<array>
432+
<dict>
433+
<key>source</key>
434+
<string>func testParasType(var a: Int, let b: Int, inout c: Int, d: Int) {</string>
435+
<key>uniform</key>
436+
<string>func testParasType(var a: Int, let b: Int, inout c: Int, d: Int){</string>
437+
<key>result</key>
438+
<string>/**
439+
&lt;#Description#&gt;
440+
441+
:param: a &lt;#a description#&gt;
442+
:param: b &lt;#b description#&gt;
443+
:param: c &lt;#c description#&gt;
444+
:param: d &lt;#d description#&gt;
445+
*/</string>
446+
</dict>
432447
<dict>
433448
<key>source</key>
434449
<string>func sayHello(personName: String) -&gt; String {</string>

VVDocumenterTests/VVTestHelper.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ +(NSArray *) testCodes
6969

7070
NSArray *swiftFunctions = @[@"func sayHello(personName: String) -> String {",
7171
@"func halfOpenRangeLength(start: Int, end: Int) -> Int\n {",
72-
@"func sayHelloWorld() ->String"];
72+
@"func sayHelloWorld() ->String",
73+
@"func testParamsType(var a: Int) {"];
7374

7475
/*
7576
//Now there is no difference between Objective-C (C) struct and Swift struct. Ignore this.
@@ -134,6 +135,7 @@ +(NSArray *) uniformCodes
134135
NSArray *swiftFunctions = @[@"func sayHello(personName: String)-> String {",
135136
@"func halfOpenRangeLength(start: Int, end: Int)-> Int {",
136137
@"func sayHelloWorld()->String",
138+
@"func testParamsType(var a: Int){",
137139
@"init(style: Style, gearing: Gearing, handlebar: Handlebar, frameSize centimeters: Int) {"];
138140

139141
/*

0 commit comments

Comments
 (0)