Skip to content

Commit

Permalink
Merge pull request #3657 from Hackerpilot/issue-12888
Browse files Browse the repository at this point in the history
Issue 12888 - Include template constraints in JSON output
  • Loading branch information
9rnsr committed Jan 28, 2015
2 parents 1acee59 + 133754c commit 821e131
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/json.c
Expand Up @@ -789,6 +789,12 @@ class ToJsonVisitor : public Visitor
}
arrayEnd();

Expression *expression = d->constraint;
if (expression)
{
property("constraint", expression->toChars());
}

propertyStart("members");
arrayStart();
for (size_t i = 0; i < d->members->dim; i++)
Expand Down
14 changes: 14 additions & 0 deletions test/compilable/extra-files/json.out
Expand Up @@ -565,6 +565,20 @@
"char" : 5
}
]
},
{
"kind" : "template",
"line" : 112,
"char" : 1,
"name" : "IncludeConstraint",
"parameters" : [
{
"name" : "T",
"kind" : "type"
}
],
"constraint" : "T == string",
"members" : []
}
]
}
Expand Down
2 changes: 2 additions & 0 deletions test/compilable/json.d
Expand Up @@ -108,3 +108,5 @@ enum Numbers
unspecified4,
four = 4,
}

template IncludeConstraint(T) if (T == string) {}

0 comments on commit 821e131

Please sign in to comment.