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. 1
      src/Core/Parser/ASTConverter.cs
  2. 4
      src/Generator/Generators/CSharp/CSharpCommentPrinter.cs

1
src/Core/Parser/ASTConverter.cs

@ -1752,6 +1752,7 @@ 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;
if (comment.ParagraphComment != null)
blockCommandComment.ParagraphComment = (AST.ParagraphComment) Visit(comment.ParagraphComment); blockCommandComment.ParagraphComment = (AST.ParagraphComment) Visit(comment.ParagraphComment);
for (uint i = 0; i < comment.ArgumentsCount; i++) for (uint i = 0; i < comment.ArgumentsCount; i++)
{ {

4
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,6 +43,7 @@ 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));
if (paramCommandComment.ParagraphComment != null)
foreach (var inlineContentComment in paramCommandComment.ParagraphComment.Content) foreach (var inlineContentComment in paramCommandComment.ParagraphComment.Content)
inlineContentComment.GetCommentSections(sections); inlineContentComment.GetCommentSections(sections);
break; break;

Loading…
Cancel
Save