[Issue 13384] New: Support JSON output for new package(names) protection

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Aug 27 08:17:09 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13384

          Issue ID: 13384
           Summary: Support JSON output for new package(names) protection
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: k.hara.pg at gmail.com

>From the github discussion:
https://github.com/D-Programming-Language/dmd/pull/3906

This code:

// test.d
module a.b.c;
package(a.b) void foo() {}

With the command line:
dmd -o- -X test.d

Outputs test.json:
[
 {
  "name" : "a.b.c",
  "kind" : "module",
  "file" : "test.d",
  "members" : [
   {
    "name" : "foo",
    "kind" : "function",
    "protection" : "package",
    "line" : 2,
    "char" : 19,
    "deco" : "FZv",
    "endline" : 2,
    "endchar" : 26
   }
  ]
 }
]

It does not contain information about the extra part of the package protection
'(a.b)'.

For backward compatibility, it would be better to keep the "protection"
property as-is. For the extra part, I'd propose to add a new JSON property
"protectionPackage". For example:

    ...
    "name" : "foo",
    "kind" : "function",
    "protection" : "package",
    "protectionPackage" : "a.b",   // New!
    "line" : 2,
    ...

--


More information about the Digitalmars-d-bugs mailing list