| ... | @@ -79,10 +79,12 @@ const Dump = struct { | ... | @@ -79,10 +79,12 @@ const Dump = struct { |
| 79 | try mergeSameStrings(&self.zig_version, zig_version); | 79 | try mergeSameStrings(&self.zig_version, zig_version); |
| 80 | try mergeSameStrings(&self.root_name, root_name); | 80 | try mergeSameStrings(&self.root_name, root_name); |
| 81 | | 81 | |
| 82 | const target = params.get("target").?.value.String; | 82 | for (params.get("builds").?.value.Array.toSliceConst()) |json_build| { |
| 83 | try self.targets.append(target); | 83 | const target = json_build.Object.get("target").?.value.String; |
| | 84 | try self.targets.append(target); |
| | 85 | } |
| 84 | | 86 | |
| 85 | // Merge files | 87 | // Merge files. If the string matches, it's the same file. |
| 86 | const other_files = root.Object.get("files").?.value.Array.toSliceConst(); | 88 | const other_files = root.Object.get("files").?.value.Array.toSliceConst(); |
| 87 | var other_file_to_mine = std.AutoHashMap(usize, usize).init(self.a()); | 89 | var other_file_to_mine = std.AutoHashMap(usize, usize).init(self.a()); |
| 88 | for (other_files) |other_file, i| { | 90 | for (other_files) |other_file, i| { |
| ... | @@ -94,7 +96,7 @@ const Dump = struct { | ... | @@ -94,7 +96,7 @@ const Dump = struct { |
| 94 | try other_file_to_mine.putNoClobber(i, gop.kv.value); | 96 | try other_file_to_mine.putNoClobber(i, gop.kv.value); |
| 95 | } | 97 | } |
| 96 | | 98 | |
| 97 | // Merge ast nodes | 99 | // Merge AST nodes. If the file id, line, and column all match, it's the same AST node. |
| 98 | const other_ast_nodes = root.Object.get("astNodes").?.value.Array.toSliceConst(); | 100 | const other_ast_nodes = root.Object.get("astNodes").?.value.Array.toSliceConst(); |
| 99 | var other_ast_node_to_mine = std.AutoHashMap(usize, usize).init(self.a()); | 101 | var other_ast_node_to_mine = std.AutoHashMap(usize, usize).init(self.a()); |
| 100 | for (other_ast_nodes) |other_ast_node_json, i| { | 102 | for (other_ast_nodes) |other_ast_node_json, i| { |
| ... | @@ -125,6 +127,8 @@ const Dump = struct { | ... | @@ -125,6 +127,8 @@ const Dump = struct { |
| 125 | } | 127 | } |
| 126 | } | 128 | } |
| 127 | } | 129 | } |
| | 130 | |
| | 131 | // Merge errors. If the AST Node matches, it's the same error value. |
| 128 | } | 132 | } |
| 129 | | 133 | |
| 130 | fn render(self: *Dump, stream: var) !void { | 134 | fn render(self: *Dump, stream: var) !void { |
| ... | @@ -139,6 +143,31 @@ const Dump = struct { | ... | @@ -139,6 +143,31 @@ const Dump = struct { |
| 139 | } | 143 | } |
| 140 | try jw.endArray(); | 144 | try jw.endArray(); |
| 141 | | 145 | |
| | 146 | try jw.objectField("params"); |
| | 147 | try jw.beginObject(); |
| | 148 | |
| | 149 | try jw.objectField("zigId"); |
| | 150 | try jw.emitString(self.zig_id.?); |
| | 151 | |
| | 152 | try jw.objectField("zigVersion"); |
| | 153 | try jw.emitString(self.zig_version.?); |
| | 154 | |
| | 155 | try jw.objectField("rootName"); |
| | 156 | try jw.emitString(self.root_name.?); |
| | 157 | |
| | 158 | try jw.objectField("builds"); |
| | 159 | try jw.beginArray(); |
| | 160 | for (self.targets.toSliceConst()) |target| { |
| | 161 | try jw.arrayElem(); |
| | 162 | try jw.beginObject(); |
| | 163 | try jw.objectField("target"); |
| | 164 | try jw.emitString(target); |
| | 165 | try jw.endObject(); |
| | 166 | } |
| | 167 | try jw.endArray(); |
| | 168 | |
| | 169 | try jw.endObject(); |
| | 170 | |
| 142 | try jw.objectField("astNodes"); | 171 | try jw.objectField("astNodes"); |
| 143 | try jw.beginArray(); | 172 | try jw.beginArray(); |
| 144 | for (self.node_list.toSliceConst()) |node| { | 173 | for (self.node_list.toSliceConst()) |node| { |