Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
k--kato committed Jan 3, 2016
1 parent 5a50aa3 commit 20d0932
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/Domain/Lang/DocommentDomainCSharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export class DocommentDomainCSharp extends DocommentDomain {
case CodeType.Field:
break;
case CodeType.Property:
hasReturn = SyntacticAnalysisCSharp.HasPropertyReturn(code);
break;
case CodeType.None:
return '';
Expand Down
18 changes: 14 additions & 4 deletions src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@ export class SyntacticAnalysisCSharp {
}

public static IsProperty(code: string): boolean {
return code.match(/\w+[^)]?\b{/) !== null;
return code.match(/[\w\S]+[^)]?\b\s*{/) !== null;
}

public static IsField(code: string): boolean {
return code.match(/;[ \t]*$/) !== null;
}

public static IsMethod(code: string): boolean {
return code.match(/\w\s\w*\s*\(.*\)/) !== null;
return code.match(/[\w\S]\s+[\w\S]+\s*\(.*\)/) !== null;
}


public static GetMethodParamNameList(code: string): Array<string> {
const params: RegExpMatchArray = code.match(/\w\s\w*\s*\((.*)\)/);
const params: RegExpMatchArray = code.match(/[\w\S]\s+[\w\S]+\s*\((.*)\)/);

const isMatched = (params === null || params.length !== 2);
if (isMatched) return null;
Expand All @@ -69,11 +69,21 @@ export class SyntacticAnalysisCSharp {
}

public static HasMethodReturn(code: string): boolean {
const returns: RegExpMatchArray = code.match(/(\w+)\s\w+\s*\(.*\)/);
const returns: RegExpMatchArray = code.match(/([\w\S]+)\s+[\w\S]+\s*\(.*\)/);

const isMatched = (returns === null || returns.length !== 2);
if (isMatched) return false;

return (returns[1].match(this.RESERVED_WORDS) === null) ? true : false;
}

public static HasPropertyReturn(code: string): boolean {
const returns: RegExpMatchArray = code.match(/([\w\S]+)\s+[\w\S]+\s*\{/);

const isMatched = (returns === null || returns.length !== 2);
if (isMatched) return false;

return (returns[1].match(this.RESERVED_WORDS) === null) ? true : false;
}

}

0 comments on commit 20d0932

Please sign in to comment.