authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-10-11 17:21:13-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-10-11 18:14:06-04:00
log8b45921664c8f679c8154b45add84f84e3ec8128
treec0ffc7b585765546d467def67b91de7d82a32381
parent30a555eed4d48b602b2c92a05c443e03c4660d48
signaturelock-open Commit is signed but in an unrecognized format.

merge targets of generated docs


3 files changed, 40 insertions(+), 5 deletions(-)

lib/std/special/docs/main.js+1-1
...@@ -305,7 +305,7 @@...@@ -305,7 +305,7 @@
305305
306 function renderInfo() {306 function renderInfo() {
307 domTdZigVer.textContent = zigAnalysis.params.zigVersion;307 domTdZigVer.textContent = zigAnalysis.params.zigVersion;
308 domTdTarget.textContent = zigAnalysis.params.target;308 domTdTarget.textContent = zigAnalysis.params.builds[0].target;
309309
310 domSectInfo.classList.remove("hidden");310 domSectInfo.classList.remove("hidden");
311 }311 }
src/dump_analysis.cpp+6
...@@ -1207,10 +1207,16 @@ void zig_print_analysis_dump(CodeGen *g, FILE *f, const char *one_indent, const...@@ -1207,10 +1207,16 @@ void zig_print_analysis_dump(CodeGen *g, FILE *f, const char *one_indent, const
1207 jw_object_field(jw, "zigVersion");1207 jw_object_field(jw, "zigVersion");
1208 jw_string(jw, ZIG_VERSION_STRING);1208 jw_string(jw, ZIG_VERSION_STRING);
12091209
1210 jw_object_field(jw, "builds");
1211 jw_begin_array(jw);
1212 jw_array_elem(jw);
1213 jw_begin_object(jw);
1210 jw_object_field(jw, "target");1214 jw_object_field(jw, "target");
1211 Buf triple_buf = BUF_INIT;1215 Buf triple_buf = BUF_INIT;
1212 target_triple_zig(&triple_buf, g->zig_target);1216 target_triple_zig(&triple_buf, g->zig_target);
1213 jw_string(jw, buf_ptr(&triple_buf));1217 jw_string(jw, buf_ptr(&triple_buf));
1218 jw_end_object(jw);
1219 jw_end_array(jw);
12141220
1215 jw_object_field(jw, "rootName");1221 jw_object_field(jw, "rootName");
1216 jw_string(jw, buf_ptr(g->root_out_name));1222 jw_string(jw, buf_ptr(g->root_out_name));
tools/merge_anal_dumps.zig+33-4
...@@ -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);
8181
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 }
8486
85 // Merge files87 // 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 }
9698
97 // Merge ast nodes99 // 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 }
129133
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();
141145
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| {