Skip to content

Commit

Permalink
Merge pull request #3169 from 9rnsr/fix12017
Browse files Browse the repository at this point in the history
[REG2.065a] Issue 12017 - DDoc leaves out the majority of documentation
  • Loading branch information
WalterBright authored and AndrewEdwards committed Feb 1, 2014
1 parent 3aa239b commit c45c70b
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 11 deletions.
13 changes: 10 additions & 3 deletions src/attrib.c
Expand Up @@ -239,7 +239,8 @@ void AttribDeclaration::emitComment(Scope *sc)
if (d)
{
for (size_t i = 0; i < d->dim; i++)
{ Dsymbol *s = (*d)[i];
{
Dsymbol *s = (*d)[i];
//printf("AttribDeclaration::emitComment %s\n", s->toChars());
s->emitComment(sc);
}
Expand Down Expand Up @@ -736,8 +737,13 @@ void ProtDeclaration::semantic(Scope *sc)

void ProtDeclaration::emitComment(Scope *sc)
{
if (protection != PROTprivate)
if (decl)
{
sc = sc->push();
sc->protection = protection;
AttribDeclaration::emitComment(sc);
sc = sc->pop();
}
}

void ProtDeclaration::protectionToCBuffer(OutBuffer *buf, PROT protection)
Expand Down Expand Up @@ -1314,7 +1320,8 @@ void ConditionalDeclaration::emitComment(Scope *sc)
*/
Dsymbols *d = decl ? decl : elsedecl;
for (size_t i = 0; i < d->dim; i++)
{ Dsymbol *s = (*d)[i];
{
Dsymbol *s = (*d)[i];
s->emitComment(sc);
}
}
Expand Down
17 changes: 9 additions & 8 deletions src/doc.c
Expand Up @@ -678,8 +678,8 @@ void Declaration::emitComment(Scope *sc)
//printf("Declaration::emitComment(%p '%s'), comment = '%s'\n", this, toChars(), comment);
//printf("type = %p\n", type);

if (protection == PROTprivate || !ident ||
(!type && !isCtorDeclaration() && !isAliasDeclaration()))
if (protection == PROTprivate || sc->protection == PROTprivate ||
!ident || (!type && !isCtorDeclaration() && !isAliasDeclaration()))
return;
if (!comment)
return;
Expand Down Expand Up @@ -710,7 +710,7 @@ void Declaration::emitComment(Scope *sc)
void AggregateDeclaration::emitComment(Scope *sc)
{
//printf("AggregateDeclaration::emitComment() '%s'\n", toChars());
if (prot() == PROTprivate)
if (prot() == PROTprivate || sc->protection == PROTprivate)
return;
if (!comment)
return;
Expand Down Expand Up @@ -741,7 +741,7 @@ void AggregateDeclaration::emitComment(Scope *sc)
void TemplateDeclaration::emitComment(Scope *sc)
{
//printf("TemplateDeclaration::emitComment() '%s', kind = %s\n", toChars(), kind());
if (prot() == PROTprivate)
if (prot() == PROTprivate || sc->protection == PROTprivate)
return;

const utf8_t *com = comment;
Expand Down Expand Up @@ -796,10 +796,11 @@ void TemplateDeclaration::emitComment(Scope *sc)

void EnumDeclaration::emitComment(Scope *sc)
{
if (prot() == PROTprivate)
if (prot() == PROTprivate || sc->protection == PROTprivate)
return;
// if (!comment)
{ if (isAnonymous() && members)
//if (!comment)
{
if (isAnonymous() && members)
{
for (size_t i = 0; i < members->dim; i++)
{
Expand Down Expand Up @@ -840,7 +841,7 @@ void EnumDeclaration::emitComment(Scope *sc)
void EnumMember::emitComment(Scope *sc)
{
//printf("EnumMember::emitComment(%p '%s'), comment = '%s'\n", this, toChars(), comment);
if (prot() == PROTprivate)
if (prot() == PROTprivate || sc->protection == PROTprivate)
return;
if (!comment)
return;
Expand Down
49 changes: 49 additions & 0 deletions test/compilable/ddoc11479.d
Expand Up @@ -14,8 +14,17 @@ struct S1(T)
private:
int x;

private:
///
int y;

///
public:
int b;

public:
///
int c;
}


Expand All @@ -30,6 +39,13 @@ struct S2(T)

///
int b;

///
public int c;

public
///
int d;
}


Expand All @@ -44,4 +60,37 @@ struct S3(T)

///
int b;

///
private
{
int y;

public
{
int c;
}
}

private
{
int z;

///
public
{
int d;
}
}

private
{
int w;

public
{
///
int e;
}
}
}
28 changes: 28 additions & 0 deletions test/compilable/extra-files/ddoc11479.html
Expand Up @@ -11,6 +11,14 @@ <h1>ddoc11479</h1>
</big></dt>
<dd><br><br>
</dd>
<dt><big><a name="b"></a>int <u>b</u>;
</big></dt>
<dd><br><br>
</dd>
<dt><big><a name="c"></a>int <u>c</u>;
</big></dt>
<dd><br><br>
</dd>
</dl>
</dd>
<dt><big><a name="S2"></a>struct <u>S2</u>(T);
Expand All @@ -24,6 +32,14 @@ <h1>ddoc11479</h1>
</big></dt>
<dd><br><br>
</dd>
<dt><big><a name="c"></a>int <u>c</u>;
</big></dt>
<dd><br><br>
</dd>
<dt><big><a name="d"></a>int <u>d</u>;
</big></dt>
<dd><br><br>
</dd>
</dl>
</dd>
<dt><big><a name="S3"></a>struct <u>S3</u>(T);
Expand All @@ -37,6 +53,18 @@ <h1>ddoc11479</h1>
</big></dt>
<dd><br><br>
</dd>
<dt><big><a name="c"></a>int <u>c</u>;
</big></dt>
<dd><br><br>
</dd>
<dt><big><a name="d"></a>int <u>d</u>;
</big></dt>
<dd><br><br>
</dd>
<dt><big><a name="e"></a>int <u>e</u>;
</big></dt>
<dd><br><br>
</dd>
</dl>
</dd>
</dl>
Expand Down

0 comments on commit c45c70b

Please sign in to comment.