Skip to content

Commit

Permalink
Merge pull request #1515 from WalterBright/b18
Browse files Browse the repository at this point in the history
fix Issue 3404 - JSON output should retain original alias names
  • Loading branch information
WalterBright committed Jan 20, 2013
2 parents 73b3b2e + 9f349df commit bac55b3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/json.c
Expand Up @@ -267,6 +267,9 @@ void Declaration::toJsonBuffer(OutBuffer *buf)
if (type)
JsonProperty(buf, Ptype, type->toChars());

if (originalType && type != originalType)
JsonProperty(buf, "originalType", originalType->toChars());

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

Expand Down
15 changes: 15 additions & 0 deletions test/compilable/extra-files/json.out
Expand Up @@ -13,6 +13,21 @@
"kind" : "enum",
"protection" : "public",
"line" : 7}
,
{
"name" : "myInt",
"kind" : "alias",
"protection" : "public",
"type" : "int",
"line" : 10}
,
{
"name" : "x",
"kind" : "variable",
"protection" : "public",
"type" : "int",
"originalType" : "myInt",
"line" : 11}
]
}
]
4 changes: 4 additions & 0 deletions test/compilable/json.d
Expand Up @@ -5,3 +5,7 @@
struct X;

enum Y;

// 3404
alias int myInt;
myInt x;

0 comments on commit bac55b3

Please sign in to comment.