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

Loading…
Cancel
Save