diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-10-11 17:21:13 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-10-11 18:14:06 -0400 |
| commit | 8b45921664c8f679c8154b45add84f84e3ec8128 (patch) | |
| tree | c0ffc7b585765546d467def67b91de7d82a32381 /tools | |
| parent | 30a555eed4d48b602b2c92a05c443e03c4660d48 (diff) | |
| download | zig-8b45921664c8f679c8154b45add84f84e3ec8128.tar.gz zig-8b45921664c8f679c8154b45add84f84e3ec8128.zip | |
merge targets of generated docs
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/merge_anal_dumps.zig | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/tools/merge_anal_dumps.zig b/tools/merge_anal_dumps.zig index ccd13999df..53f9e438aa 100644 --- a/tools/merge_anal_dumps.zig +++ b/tools/merge_anal_dumps.zig @@ -79,10 +79,12 @@ const Dump = struct { try mergeSameStrings(&self.zig_version, zig_version); try mergeSameStrings(&self.root_name, root_name); - const target = params.get("target").?.value.String; - try self.targets.append(target); + for (params.get("builds").?.value.Array.toSliceConst()) |json_build| { + const target = json_build.Object.get("target").?.value.String; + try self.targets.append(target); + } - // Merge files + // Merge files. If the string matches, it's the same file. const other_files = root.Object.get("files").?.value.Array.toSliceConst(); var other_file_to_mine = std.AutoHashMap(usize, usize).init(self.a()); for (other_files) |other_file, i| { @@ -94,7 +96,7 @@ const Dump = struct { try other_file_to_mine.putNoClobber(i, gop.kv.value); } - // Merge ast nodes + // Merge AST nodes. If the file id, line, and column all match, it's the same AST node. const other_ast_nodes = root.Object.get("astNodes").?.value.Array.toSliceConst(); var other_ast_node_to_mine = std.AutoHashMap(usize, usize).init(self.a()); for (other_ast_nodes) |other_ast_node_json, i| { @@ -125,6 +127,8 @@ const Dump = struct { } } } + + // Merge errors. If the AST Node matches, it's the same error value. } fn render(self: *Dump, stream: var) !void { @@ -139,6 +143,31 @@ const Dump = struct { } try jw.endArray(); + try jw.objectField("params"); + try jw.beginObject(); + + try jw.objectField("zigId"); + try jw.emitString(self.zig_id.?); + + try jw.objectField("zigVersion"); + try jw.emitString(self.zig_version.?); + + try jw.objectField("rootName"); + try jw.emitString(self.root_name.?); + + try jw.objectField("builds"); + try jw.beginArray(); + for (self.targets.toSliceConst()) |target| { + try jw.arrayElem(); + try jw.beginObject(); + try jw.objectField("target"); + try jw.emitString(target); + try jw.endObject(); + } + try jw.endArray(); + + try jw.endObject(); + try jw.objectField("astNodes"); try jw.beginArray(); for (self.node_list.toSliceConst()) |node| { |
