authorgravatar for kappaloris@gmail.comLoris Cro <kappaloris@gmail.com> 2022-05-15 22:57:12+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-19 19:10:11-07:00
log0339e1c7d4fc3cc2144f4f5aae335b16fa808531
tree1f9bc7224f300e4c44dfd57db228a8574e3a558f
parentae4b5c29b27990cdb5b0b517965bd6a21294d35a

update to new code from master branch


1 files changed, 40 insertions(+), 40 deletions(-)

src/Autodoc.zig+40-40
......@@ -85,7 +85,7 @@ pub fn generateZirData(self: *Autodoc) !void {
8585 var i: u32 = 1;
8686 while (i <= @enumToInt(Ref.anyerror_void_error_union_type)) : (i += 1) {
8787 var tmpbuf = std.ArrayList(u8).init(self.arena);
88 try Ref.typed_value_map[i].val.format("", .{}, tmpbuf.writer());
88 try Ref.typed_value_map[i].val.fmtDebug().format("", .{}, tmpbuf.writer());
8989 try self.types.append(
9090 self.arena,
9191 switch (@intToEnum(Ref, i)) {
......@@ -224,11 +224,11 @@ pub fn generateZirData(self: *Autodoc) !void {
224224 ) catch unreachable;
225225 out.print(";", .{}) catch unreachable;
226226 // copy main.js, index.html
227 const special = try self.module.comp.zig_lib_directory.join(self.arena, &.{ "std", "special", "docs", std.fs.path.sep_str });
228 var special_dir = std.fs.openDirAbsolute(special, .{}) catch unreachable;
229 defer special_dir.close();
230 special_dir.copyFile("main.js", output_dir, "main.js", .{}) catch unreachable;
231 special_dir.copyFile("index.html", output_dir, "index.html", .{}) catch unreachable;
227 const docs = try self.module.comp.zig_lib_directory.join(self.arena, &.{ "docs", std.fs.path.sep_str });
228 var docs_dir = std.fs.openDirAbsolute(docs, .{}) catch unreachable;
229 defer docs_dir.close();
230 docs_dir.copyFile("main.js", output_dir, "main.js", .{}) catch unreachable;
231 docs_dir.copyFile("index.html", output_dir, "index.html", .{}) catch unreachable;
232232}
233233
234234/// Represents a chain of scopes, used to resolve decl references to the
......@@ -1208,33 +1208,33 @@ fn walkInstruction(
12081208 },
12091209
12101210 .opaque_decl => return self.cteTodo("opaque {...}"),
1211 .func => {
1212 const type_slot_index = self.types.items.len;
1213 try self.types.append(self.arena, .{ .Unanalyzed = {} });
1214
1215 const result = try self.analyzeFunction(
1216 file,
1217 parent_scope,
1218 inst_index,
1219 self_ast_node_index,
1220 type_slot_index,
1221 );
1222 if (self.ref_paths_pending_on_types.get(type_slot_index)) |paths| {
1223 for (paths.items) |resume_info| {
1224 try self.tryResolveRefPath(
1225 resume_info.file,
1226 inst_index,
1227 resume_info.ref_path,
1228 );
1229 }
1230
1231 _ = self.ref_paths_pending_on_types.remove(type_slot_index);
1232 // TODO: we should deallocate the arraylist that holds all the
1233 // decl paths. not doing it now since it's arena-allocated
1234 // anyway, but maybe we should put it elsewhere.
1235 }
1236 return result;
1237 },
1211 // .func => {
1212 // const type_slot_index = self.types.items.len;
1213 // try self.types.append(self.arena, .{ .Unanalyzed = {} });
1214 //
1215 // const result = try self.analyzeFunction(
1216 // file,
1217 // parent_scope,
1218 // inst_index,
1219 // self_ast_node_index,
1220 // type_slot_index,
1221 // );
1222 // if (self.ref_paths_pending_on_types.get(type_slot_index)) |paths| {
1223 // for (paths.items) |resume_info| {
1224 // try self.tryResolveRefPath(
1225 // resume_info.file,
1226 // inst_index,
1227 // resume_info.ref_path,
1228 // );
1229 // }
1230 //
1231 // _ = self.ref_paths_pending_on_types.remove(type_slot_index);
1232 // // TODO: we should deallocate the arraylist that holds all the
1233 // // decl paths. not doing it now since it's arena-allocated
1234 // // anyway, but maybe we should put it elsewhere.
1235 // }
1236 // return result;
1237 // },
12381238 .variable => {
12391239 const small = @bitCast(Zir.Inst.ExtendedVar.Small, extended.small);
12401240 var extra_index: usize = extended.operand;
......@@ -1731,16 +1731,16 @@ fn walkDecls(
17311731 const func_index = getBlockInlineBreak(file.zir, value_index);
17321732 // a decltest is always a function
17331733 const tag = file.zir.instructions.items(.tag)[Zir.refToIndex(func_index).?];
1734 std.debug.assert(tag == .extended);
1734 std.debug.assert(tag == .func_extended);
17351735
1736 const extended = file.zir.instructions.items(.data)[Zir.refToIndex(func_index).?].extended;
1737 const extra = file.zir.extraData(Zir.Inst.ExtendedFunc, extended.operand);
1738 const small = @bitCast(Zir.Inst.ExtendedFunc.Small, extended.small);
1736 const pl_node = file.zir.instructions.items(.data)[Zir.refToIndex(func_index).?].pl_node;
1737 const extra = file.zir.extraData(Zir.Inst.ExtendedFunc, pl_node.payload_index);
1738 const bits = @bitCast(Zir.Inst.ExtendedFunc.Bits, extra.data.bits);
17391739
17401740 var extra_index_for_this_func: usize = extra.end;
1741 if (small.has_lib_name) extra_index_for_this_func += 1;
1742 if (small.has_cc) extra_index_for_this_func += 1;
1743 if (small.has_align) extra_index_for_this_func += 1;
1741 if (bits.has_lib_name) extra_index_for_this_func += 1;
1742 if (bits.has_cc) extra_index_for_this_func += 1;
1743 if (bits.has_align) extra_index_for_this_func += 1;
17441744
17451745 const ret_ty_body = file.zir.extra[extra_index_for_this_func..][0..extra.data.ret_body_len];
17461746 extra_index_for_this_func += ret_ty_body.len;