Showing with 146 additions and 12 deletions.
  1. +33 −11 src/doc.d
  2. +42 −0 test/compilable/ddoc14778.d
  3. +1 −1 test/compilable/extra-files/ddoc10.html
  4. +70 −0 test/compilable/extra-files/ddoc14778.html
44 changes: 33 additions & 11 deletions src/doc.d
Original file line number Diff line number Diff line change
Expand Up @@ -870,8 +870,15 @@ extern (C++) void emitComment(Dsymbol s, OutBuffer* buf, Scope* sc)
{
if (!d.ident)
return;
if (!d.type && !d.isCtorDeclaration() && !d.isAliasDeclaration())
return;
if (!d.type)
{
if (!d.isCtorDeclaration() &&
!d.isAliasDeclaration() &&
!d.isVarDeclaration())
{
return;
}
}
if (d.protection.kind == PROTprivate || sc.protection.kind == PROTprivate)
return;
}
Expand Down Expand Up @@ -1046,16 +1053,31 @@ extern (C++) void toDocBuffer(Dsymbol s, OutBuffer* buf, Scope* sc)
buf.writestring("final ");
else if (d.isAbstract())
buf.writestring("abstract ");
if (!d.isFuncDeclaration()) // functionToBufferFull handles this

if (d.isFuncDeclaration()) // functionToBufferFull handles this
return;

if (d.isImmutable())
buf.writestring("immutable ");
if (d.storage_class & STCshared)
buf.writestring("shared ");
if (d.isWild())
buf.writestring("inout ");
if (d.isConst())
buf.writestring("const ");

if (d.isSynchronized())
buf.writestring("synchronized ");

if (d.storage_class & STCmanifest)
buf.writestring("enum ");

// Add "auto" for the untyped variable in template members
if (!d.type && d.isVarDeclaration() &&
!d.isImmutable() && !(d.storage_class & STCshared) && !d.isWild() && !d.isConst() &&
!d.isSynchronized())
{
if (d.isConst())
buf.writestring("const ");
if (d.isImmutable())
buf.writestring("immutable ");
if (d.isSynchronized())
buf.writestring("synchronized ");
if (d.storage_class & STCmanifest)
buf.writestring("enum ");
buf.writestring("auto ");
}
}
}
Expand Down
42 changes: 42 additions & 0 deletions test/compilable/ddoc14778.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// PERMUTE_ARGS:
// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 14778

module ddoc14778;

/// docs for Z
template Z14778(T)
{
/// docs for E
enum E;

/// docs for x
enum x = 1.0;

/// docs for mv
auto mv = 1;

/// docs for wv
inout wv = 3;

/// doc for cv
const cv = "a";

/// docs for wcv
inout const wcv = "ab";

/// doc for sv
shared sv = 1.4142;

/// doc for swv
shared inout swv = 3.14;

/// doc for scv
shared const scv = new Object();

/// docs for swcv
shared inout const swcv = undefined;

/// doc for iv
immutable iv = [1,2,3];
}
2 changes: 1 addition & 1 deletion test/compilable/extra-files/ddoc10.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ <h1>ddoc10</h1>
<dd>doc-comment<br><br>

</dd>
<dt><big><a name="isInt14547"></a>enum <u>isInt14547</u>(T);
<dt><big><a name="isInt14547"></a>enum auto <u>isInt14547</u>(T);
<br><a name="isString14547"></a>enum bool <u>isString14547</u>(T);
<br><a name="typeName14547"></a>static immutable <u>typeName14547</u>(T);
<br><a name="storageFor14547"></a>int <u>storageFor14547</u>(T);
Expand Down
70 changes: 70 additions & 0 deletions test/compilable/extra-files/ddoc14778.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<html><head>
<META http-equiv="content-type" content="text/html; charset=utf-8">
<title>ddoc14778</title>
</head><body>
<h1>ddoc14778</h1>
<br><br>
<dl><dt><big><a name="Z14778"></a>template <u>Z14778</u>(T)</big></dt>
<dd>docs for Z<br><br>

<dl><dt><big><a name="Z14778.E"></a>enum <u>E</u>;
</big></dt>
<dd>docs for <u>E</u><br><br>

</dd>
<dt><big><a name="Z14778.x"></a>enum auto <u>x</u>;
</big></dt>
<dd>docs for <u>x</u><br><br>

</dd>
<dt><big><a name="Z14778.mv"></a>auto <u>mv</u>;
</big></dt>
<dd>docs for <u>mv</u><br><br>

</dd>
<dt><big><a name="Z14778.wv"></a>inout <u>wv</u>;
</big></dt>
<dd>docs for <u>wv</u><br><br>

</dd>
<dt><big><a name="Z14778.cv"></a>const <u>cv</u>;
</big></dt>
<dd>doc for <u>cv</u><br><br>

</dd>
<dt><big><a name="Z14778.wcv"></a>inout const <u>wcv</u>;
</big></dt>
<dd>docs for <u>wcv</u><br><br>

</dd>
<dt><big><a name="Z14778.sv"></a>shared <u>sv</u>;
</big></dt>
<dd>doc for <u>sv</u><br><br>

</dd>
<dt><big><a name="Z14778.swv"></a>shared inout <u>swv</u>;
</big></dt>
<dd>doc for <u>swv</u><br><br>

</dd>
<dt><big><a name="Z14778.scv"></a>shared const <u>scv</u>;
</big></dt>
<dd>doc for <u>scv</u><br><br>

</dd>
<dt><big><a name="Z14778.swcv"></a>shared inout const <u>swcv</u>;
</big></dt>
<dd>docs for <u>swcv</u><br><br>

</dd>
<dt><big><a name="Z14778.iv"></a>immutable <u>iv</u>;
</big></dt>
<dd>doc for <u>iv</u><br><br>

</dd>
</dl>
</dd>
</dl>

<hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small>
</body></html>