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 {...@@ -85,7 +85,7 @@ pub fn generateZirData(self: *Autodoc) !void {
85 var i: u32 = 1;85 var i: u32 = 1;
86 while (i <= @enumToInt(Ref.anyerror_void_error_union_type)) : (i += 1) {86 while (i <= @enumToInt(Ref.anyerror_void_error_union_type)) : (i += 1) {
87 var tmpbuf = std.ArrayList(u8).init(self.arena);87 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());
89 try self.types.append(89 try self.types.append(
90 self.arena,90 self.arena,
91 switch (@intToEnum(Ref, i)) {91 switch (@intToEnum(Ref, i)) {
...@@ -224,11 +224,11 @@ pub fn generateZirData(self: *Autodoc) !void {...@@ -224,11 +224,11 @@ pub fn generateZirData(self: *Autodoc) !void {
224 ) catch unreachable;224 ) catch unreachable;
225 out.print(";", .{}) catch unreachable;225 out.print(";", .{}) catch unreachable;
226 // copy main.js, index.html226 // 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 });227 const docs = try self.module.comp.zig_lib_directory.join(self.arena, &.{ "docs", std.fs.path.sep_str });
228 var special_dir = std.fs.openDirAbsolute(special, .{}) catch unreachable;228 var docs_dir = std.fs.openDirAbsolute(docs, .{}) catch unreachable;
229 defer special_dir.close();229 defer docs_dir.close();
230 special_dir.copyFile("main.js", output_dir, "main.js", .{}) catch unreachable;230 docs_dir.copyFile("main.js", output_dir, "main.js", .{}) catch unreachable;
231 special_dir.copyFile("index.html", output_dir, "index.html", .{}) catch unreachable;231 docs_dir.copyFile("index.html", output_dir, "index.html", .{}) catch unreachable;
232}232}
233233
234/// Represents a chain of scopes, used to resolve decl references to the234/// Represents a chain of scopes, used to resolve decl references to the
...@@ -1208,33 +1208,33 @@ fn walkInstruction(...@@ -1208,33 +1208,33 @@ fn walkInstruction(
1208 },1208 },
12091209
1210 .opaque_decl => return self.cteTodo("opaque {...}"),1210 .opaque_decl => return self.cteTodo("opaque {...}"),
1211 .func => {1211 // .func => {
1212 const type_slot_index = self.types.items.len;1212 // const type_slot_index = self.types.items.len;
1213 try self.types.append(self.arena, .{ .Unanalyzed = {} });1213 // try self.types.append(self.arena, .{ .Unanalyzed = {} });
12141214 //
1215 const result = try self.analyzeFunction(1215 // const result = try self.analyzeFunction(
1216 file,1216 // file,
1217 parent_scope,1217 // parent_scope,
1218 inst_index,1218 // inst_index,
1219 self_ast_node_index,1219 // self_ast_node_index,
1220 type_slot_index,1220 // type_slot_index,
1221 );1221 // );
1222 if (self.ref_paths_pending_on_types.get(type_slot_index)) |paths| {1222 // if (self.ref_paths_pending_on_types.get(type_slot_index)) |paths| {
1223 for (paths.items) |resume_info| {1223 // for (paths.items) |resume_info| {
1224 try self.tryResolveRefPath(1224 // try self.tryResolveRefPath(
1225 resume_info.file,1225 // resume_info.file,
1226 inst_index,1226 // inst_index,
1227 resume_info.ref_path,1227 // resume_info.ref_path,
1228 );1228 // );
1229 }1229 // }
12301230 //
1231 _ = self.ref_paths_pending_on_types.remove(type_slot_index);1231 // _ = self.ref_paths_pending_on_types.remove(type_slot_index);
1232 // TODO: we should deallocate the arraylist that holds all the1232 // // TODO: we should deallocate the arraylist that holds all the
1233 // decl paths. not doing it now since it's arena-allocated1233 // // decl paths. not doing it now since it's arena-allocated
1234 // anyway, but maybe we should put it elsewhere.1234 // // anyway, but maybe we should put it elsewhere.
1235 }1235 // }
1236 return result;1236 // return result;
1237 },1237 // },
1238 .variable => {1238 .variable => {
1239 const small = @bitCast(Zir.Inst.ExtendedVar.Small, extended.small);1239 const small = @bitCast(Zir.Inst.ExtendedVar.Small, extended.small);
1240 var extra_index: usize = extended.operand;1240 var extra_index: usize = extended.operand;
...@@ -1731,16 +1731,16 @@ fn walkDecls(...@@ -1731,16 +1731,16 @@ fn walkDecls(
1731 const func_index = getBlockInlineBreak(file.zir, value_index);1731 const func_index = getBlockInlineBreak(file.zir, value_index);
1732 // a decltest is always a function1732 // a decltest is always a function
1733 const tag = file.zir.instructions.items(.tag)[Zir.refToIndex(func_index).?];1733 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;1736 const pl_node = file.zir.instructions.items(.data)[Zir.refToIndex(func_index).?].pl_node;
1737 const extra = file.zir.extraData(Zir.Inst.ExtendedFunc, extended.operand);1737 const extra = file.zir.extraData(Zir.Inst.ExtendedFunc, pl_node.payload_index);
1738 const small = @bitCast(Zir.Inst.ExtendedFunc.Small, extended.small);1738 const bits = @bitCast(Zir.Inst.ExtendedFunc.Bits, extra.data.bits);
17391739
1740 var extra_index_for_this_func: usize = extra.end;1740 var extra_index_for_this_func: usize = extra.end;
1741 if (small.has_lib_name) extra_index_for_this_func += 1;1741 if (bits.has_lib_name) extra_index_for_this_func += 1;
1742 if (small.has_cc) extra_index_for_this_func += 1;1742 if (bits.has_cc) extra_index_for_this_func += 1;
1743 if (small.has_align) extra_index_for_this_func += 1;1743 if (bits.has_align) extra_index_for_this_func += 1;
17441744
1745 const ret_ty_body = file.zir.extra[extra_index_for_this_func..][0..extra.data.ret_body_len];1745 const ret_ty_body = file.zir.extra[extra_index_for_this_func..][0..extra.data.ret_body_len];
1746 extra_index_for_this_func += ret_ty_body.len;1746 extra_index_for_this_func += ret_ty_body.len;