Skip to content

Commit

Permalink
Include symbol protection in JSON output
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberShadow committed Jul 13, 2011
1 parent 7aeb7d2 commit 81a2010
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/json.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ const char Pline[] = "line";
const char Ptype[] = "type";
const char Pcomment[] = "comment";
const char Pmembers[] = "members";
const char Pprotection[] = "protection";
const char* Pprotectionnames[] = {NULL, "none", "private", "package", "protected", "public", "export"};

void JsonRemoveComma(OutBuffer *buf);

Expand Down Expand Up @@ -259,6 +261,10 @@ void Declaration::toJsonBuffer(OutBuffer *buf)

JsonProperty(buf, Pname, toChars());
JsonProperty(buf, Pkind, kind());

if (prot())
JsonProperty(buf, Pprotection, Pprotectionnames[prot()]);

if (type)
JsonProperty(buf, Ptype, type->toChars());

Expand All @@ -285,8 +291,13 @@ void AggregateDeclaration::toJsonBuffer(OutBuffer *buf)

JsonProperty(buf, Pname, toChars());
JsonProperty(buf, Pkind, kind());

if (prot())
JsonProperty(buf, Pprotection, Pprotectionnames[prot()]);

if (comment)
JsonProperty(buf, Pcomment, (const char *)comment);

if (loc.linnum)
JsonProperty(buf, Pline, loc.linnum);

Expand Down Expand Up @@ -344,6 +355,10 @@ void TemplateDeclaration::toJsonBuffer(OutBuffer *buf)

JsonProperty(buf, Pname, toChars());
JsonProperty(buf, Pkind, kind());

if (prot())
JsonProperty(buf, Pprotection, Pprotectionnames[prot()]);

if (comment)
JsonProperty(buf, Pcomment, (const char *)comment);

Expand Down Expand Up @@ -389,6 +404,10 @@ void EnumDeclaration::toJsonBuffer(OutBuffer *buf)

JsonProperty(buf, Pname, toChars());
JsonProperty(buf, Pkind, kind());

if (prot())
JsonProperty(buf, Pprotection, Pprotectionnames[prot()]);

if (comment)
JsonProperty(buf, Pcomment, (const char *)comment);

Expand Down Expand Up @@ -427,6 +446,9 @@ void EnumMember::toJsonBuffer(OutBuffer *buf)
JsonProperty(buf, Pname, toChars());
JsonProperty(buf, Pkind, kind());

if (prot())
JsonProperty(buf, Pprotection, Pprotectionnames[prot()]);

if (comment)
JsonProperty(buf, Pcomment, (const char *)comment);

Expand Down

0 comments on commit 81a2010

Please sign in to comment.