Parser now allows empty tables in JSON

Bug: 16870719
Change-Id: Ia5fdce49a67b1aa621ab1e37a815e2a3293257b6
Tested: on Linux
This commit is contained in:
Wouter van Oortmerssen
2014-08-12 16:20:13 -07:00
parent 620d8d6f7c
commit 0b47e69d4d
5 changed files with 15 additions and 7 deletions

View File

@@ -191,7 +191,6 @@ static void GenStruct(const StructDef &struct_def, const Table *table,
std::string *_text) {
std::string &text = *_text;
text += "{";
text += NewLine(opts.indent_step);
int fieldout = 0;
StructDef *union_sd = nullptr;
for (auto it = struct_def.fields.vec.begin();
@@ -202,8 +201,8 @@ static void GenStruct(const StructDef &struct_def, const Table *table,
// The field is present.
if (fieldout++) {
text += ",";
text += NewLine(opts.indent_step);
}
text += NewLine(opts.indent_step);
text.append(indent + opts.indent_step, ' ');
OutputIdentifier(fd.name, opts, _text);
text += ": ";