Browse Source

Checked whether block comments actually have paragraphs.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/642/head
Dimitar Dobrev 10 years ago
parent
commit
11fc1f5097
  1. 3
      src/Core/Parser/ASTConverter.cs
  2. 8
      src/Generator/Generators/CSharp/CSharpCommentPrinter.cs

3
src/Core/Parser/ASTConverter.cs

@ -1752,7 +1752,8 @@ namespace CppSharp
private void VisitBlockCommandComment(AST.BlockCommandComment blockCommandComment, BlockCommandComment comment) private void VisitBlockCommandComment(AST.BlockCommandComment blockCommandComment, BlockCommandComment comment)
{ {
blockCommandComment.CommandId = comment.CommandId; blockCommandComment.CommandId = comment.CommandId;
blockCommandComment.ParagraphComment = (AST.ParagraphComment) Visit(comment.ParagraphComment); if (comment.ParagraphComment != null)
blockCommandComment.ParagraphComment = (AST.ParagraphComment) Visit(comment.ParagraphComment);
for (uint i = 0; i < comment.ArgumentsCount; i++) for (uint i = 0; i < comment.ArgumentsCount; i++)
{ {
var argument = new AST.BlockCommandComment.Argument { Text = comment.getArguments(i).Text }; var argument = new AST.BlockCommandComment.Argument { Text = comment.getArguments(i).Text };

8
src/Generator/Generators/CSharp/CSharpCommentPrinter.cs

@ -29,7 +29,8 @@ namespace CppSharp.Generators.CSharp
break; break;
case CommentKind.BlockCommandComment: case CommentKind.BlockCommandComment:
var blockCommandComment = (BlockCommandComment) comment; var blockCommandComment = (BlockCommandComment) comment;
if (blockCommandComment.CommandKind == CommentCommandKind.Return) if (blockCommandComment.CommandKind == CommentCommandKind.Return &&
blockCommandComment.ParagraphComment != null)
{ {
sections.Add(new Section(CommentElement.Returns)); sections.Add(new Section(CommentElement.Returns));
blockCommandComment.ParagraphComment.GetCommentSections(sections); blockCommandComment.ParagraphComment.GetCommentSections(sections);
@ -42,8 +43,9 @@ namespace CppSharp.Generators.CSharp
if (paramCommandComment.Arguments.Count > 0) if (paramCommandComment.Arguments.Count > 0)
param.Attributes.Add( param.Attributes.Add(
string.Format("name=\"{0}\"", paramCommandComment.Arguments[0].Text)); string.Format("name=\"{0}\"", paramCommandComment.Arguments[0].Text));
foreach (var inlineContentComment in paramCommandComment.ParagraphComment.Content) if (paramCommandComment.ParagraphComment != null)
inlineContentComment.GetCommentSections(sections); foreach (var inlineContentComment in paramCommandComment.ParagraphComment.Content)
inlineContentComment.GetCommentSections(sections);
break; break;
case CommentKind.TParamCommandComment: case CommentKind.TParamCommandComment:
break; break;

Loading…
Cancel
Save