Bug 9706 – JSON output doesn't contain type of deduced values

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-12T11:44:40Z
Last change time
2024-12-13T18:04:52Z
Assigned to
No Owner
Creator
simendsjo
Moved to GitHub: dmd#18536 →

Comments

Comment #0 by simendsjo — 2013-03-12T11:44:40Z
Ref.: https://github.com/rejectedsoftware/ddox/issues/11 Tested on dmd 2.062 on linux x64 and x86. Given the following program: // t.d module t; template explicit() { enum bool explicit = false; } template implicit() { enum implicit = false; } void main() {} Compiled with: dmd -X -Xft.json t.d t.json doesn't include "deco" : "b" for implicit: t.json: [ { "name" : "t", "kind" : "module", "file" : "t.d", "members" : [ { "kind" : "template", "name" : "explicit()", "line" : 2, "parameters" : [], "members" : [ { "name" : "explicit", "kind" : "variable", "line" : 3, "storageClass" : [ "enum" ], "deco" : "b", "init" : "false" } ] }, { "kind" : "template", "name" : "implicit()", "line" : 5, "parameters" : [], "members" : [ { "name" : "implicit", "kind" : "variable", "line" : 6, "storageClass" : [ "enum" ], "init" : "false" } ] }, { "name" : "main", "kind" : "function", "line" : 9, "deco" : "FZv", "endline" : 9 } ] } ]
Comment #1 by andrej.mitrovich — 2013-03-12T14:29:28Z
Hmmm.. a quick hack is to try to infer the type before type is outputted: void Declaration::jsonProperties(JsonOut *json) { // ... if (!type) { VarDeclaration *vd = this->isVarDeclaration(); type = vd->init->inferType(NULL); } json->property("type", "deco", type); // ... } But that's no good, scope is missing. Anyone more experienced knows how to handle this?
Comment #2 by robert.schadek — 2024-12-13T18:04:52Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18536 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB