diff --git a/src/json.c b/src/json.c index 1adf3709b8e8..6003cce561b2 100644 --- a/src/json.c +++ b/src/json.c @@ -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); @@ -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()); @@ -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); @@ -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); @@ -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); @@ -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);