docs generation for mixins
ag0aep6g via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun May 15 12:06:59 PDT 2016
On 05/15/2016 08:41 PM, ikod wrote:
> How can I get docs generated for int z?
>
> -----
> string V(string var) {
> return "int " ~ var ~ ";";
> }
> ///
> struct X {
> /// comment for y
> int y;
> /// comment for z
> mixin(V("z"));
> }
>
> void main()
> {
> }
> -----
>
> "dmd -D -Dddocs" generate docs for "y" only.
Looks like doc generation doesn't expand mixins. I'm afraid there is no
way to do this.
Some loosely related thoughts:
Instead of mixing in the whole declaration, generate the type (or
function parameters, or whatever) with a template:
----
template V() { alias V = int; }
///
struct X {
/// comment for y
int y;
/// comment for z
V!() z;
}
----
Use a dummy declaration for doc generation:
----
/// comment for z
version (D_Ddoc) int z;
else mixin(V("z"));
----
By the way, `-Dddocs` implies `-D`. You don't need both.
More information about the Digitalmars-d-learn
mailing list