Merge pull request #1844 from alelenv/ast_print_fix

Fix bug in printing trailing comma when dumping AST for a structure.
This commit is contained in:
John Kessenich 2019-07-28 21:33:30 -06:00 committed by GitHub
commit 642b6ad99f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 26 deletions

View file

@ -2050,13 +2050,15 @@ public:
// Add struct/block members
if (isStruct() && structure) {
appendStr("{");
bool hasHiddenMember = true;
for (size_t i = 0; i < structure->size(); ++i) {
if (! (*structure)[i].type->hiddenMember()) {
if (!hasHiddenMember)
appendStr(", ");
typeString.append((*structure)[i].type->getCompleteString());
typeString.append(" ");
typeString.append((*structure)[i].type->getFieldName());
if (i < structure->size() - 1)
appendStr(", ");
hasHiddenMember = false;
}
}
appendStr("}");