Skip to content

Commit

Permalink
[Java.Interop.Tools.JavaSource] Replace TODO with To be added (#937)
Browse files Browse the repository at this point in the history
Context: #843
Context: #907

Replaces `[TODO: @tag]` values in generated docs with `To be added`
to better mirror `mdoc` behavior for missing elements.

Inline `{@value }` tags that contain an argument have been updated to
display the argument in a `<c/>` block.  These should be fixed to use
an appropriate CREF in the future; see #843.
  • Loading branch information
pjcollins authored Jan 6, 2022
1 parent 312fbf4 commit 4cbc07a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ internal void CreateRules (SourceJavadocToXmldocGrammar grammar)

InheritDocDeclaration.Rule = grammar.ToTerm ("{@inheritDoc}");
InheritDocDeclaration.AstConfig.NodeCreator = (context, parseNode) => {
parseNode.AstNode = new XText ("[TODO: @inheritDoc]");
// TODO: Iterate through parents for corresponding javadoc element.
parseNode.AstNode = new XText ("To be added");
};

LinkDeclaration.Rule = grammar.ToTerm ("{@link") + InlineValue + "}";
Expand Down Expand Up @@ -70,11 +71,13 @@ internal void CreateRules (SourceJavadocToXmldocGrammar grammar)
| grammar.ToTerm ("{@value") + InlineValue + "}";
ValueDeclaration.AstConfig.NodeCreator = (context, parseNode) => {
if (parseNode.ChildNodes.Count > 1) {
// TODO: Need to convert to appropriate CREF value, use code text for now.
var field = parseNode.ChildNodes [1].AstNode.ToString ();
parseNode.AstNode = new XText ($"[TODO: @value for `{field}`]");
parseNode.AstNode = new XElement ("c", field);
}
else {
parseNode.AstNode = new XText ("[TODO: @value]");
// TODO: Display the value of the corresponding static field.
parseNode.AstNode = new XText ("To be added");
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void InheritDocDeclaration ()

var r = p.Parse ("{@inheritDoc}");
Assert.IsFalse (r.HasErrors (), DumpMessages (r, p));
Assert.AreEqual ("[TODO: @inheritDoc]", r.Root.AstNode.ToString ());
Assert.AreEqual ("To be added", r.Root.AstNode.ToString ());
}

[Test]
Expand Down Expand Up @@ -82,11 +82,11 @@ public void ValueDeclaration ()

var r = p.Parse ("{@value}");
Assert.IsFalse (r.HasErrors (), DumpMessages (r, p));
Assert.AreEqual ("[TODO: @value]", r.Root.AstNode.ToString ());
Assert.AreEqual ("To be added", r.Root.AstNode.ToString ());

r = p.Parse ("{@value #field}");
Assert.IsFalse (r.HasErrors (), DumpMessages (r, p));
Assert.AreEqual ("[TODO: @value for `#field`]", r.Root.AstNode.ToString ());
Assert.AreEqual ("<c>#field</c>", r.Root.AstNode.ToString ());
}
}
}

0 comments on commit 4cbc07a

Please sign in to comment.