D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 11620 - dmd json output should output enum values
Summary: dmd json output should output enum values
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 enhancement
Assignee: Andrej Mitrovic
URL: https://github.com/D-Programming-Lang...
Keywords: pull
Depends on:
Blocks: 9285
  Show dependency treegraph
 
Reported: 2013-11-27 11:43 UTC by Adam D. Ruppe
Modified: 2014-04-24 13:53 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Adam D. Ruppe 2013-11-27 11:43:01 UTC
Given:
enum Numbers {
        zero = 0,
        one = 1,
        two = 2,
        FILE_NOT_FOUND = 101
}

dmd -X gives:

   {
    "name" : "Numbers",
    "kind" : "enum",
    "line" : 20,
    "baseDeco" : "i",
    "members" : [
     {
      "name" : "zero",
      "kind" : "enum member",
      "line" : 21
     },
     {
      "name" : "one",
      "kind" : "enum member",
      "line" : 22
     },
     {
      "name" : "two",
      "kind" : "enum member",
      "line" : 23
     },
     {
      "name" : "FILE_NOT_FOUND",
      "kind" : "enum member",
      "line" : 24
     }
    ]
   },



Good, but not great: it doesn't include the value given, so there's no way when reading this to know that FILE_NOT_FOUND is not equal to three.

It should include the value, if at all possible
Comment 1 github-bugzilla 2014-04-24 13:53:23 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/6fb1c2b7635824d49eebd910fe03bc7bb863492f
Fix Issue 11620 - Emit enum member values to json output.

https://github.com/D-Programming-Language/dmd/commit/6642adcf5840576ed10069cf4269fab6175fb8d2
Merge pull request #3472 from AndrejMitrovic/Fix11620

Issue 11620 - Emit enum member values to json output.