| ... | @@ -5,21 +5,28 @@ const Module = @import("Module.zig"); | ... | @@ -5,21 +5,28 @@ const Module = @import("Module.zig"); |
| 5 | const Zir = @import("Zir.zig"); | 5 | const Zir = @import("Zir.zig"); |
| 6 | | 6 | |
| 7 | module: *Module, | 7 | module: *Module, |
| 8 | doc_location: Compilation.EmitLoc, | 8 | doc_location: ?Compilation.EmitLoc, |
| 9 | | 9 | arena: std.mem.Allocator, |
| 10 | pub fn init(m: *Module, dl: Compilation.EmitLoc) Autodoc { | 10 | types: std.ArrayListUnmanaged(DocData.Type) = .{}, |
| | 11 | decls: std.ArrayListUnmanaged(DocData.Decl) = .{}, |
| | 12 | ast_nodes: std.ArrayListUnmanaged(DocData.AstNode) = .{}, |
| | 13 | |
| | 14 | var arena_allocator: std.heap.ArenaAllocator = undefined; |
| | 15 | pub fn init(m: *Module, doc_location: ?Compilation.EmitLoc) Autodoc { |
| | 16 | arena_allocator = std.heap.ArenaAllocator.init(m.gpa); |
| 11 | return .{ | 17 | return .{ |
| 12 | .doc_location = dl, | | |
| 13 | .module = m, | 18 | .module = m, |
| | 19 | .doc_location = doc_location, |
| | 20 | .arena = arena_allocator.allocator(), |
| 14 | }; | 21 | }; |
| 15 | } | 22 | } |
| 16 | | 23 | |
| 17 | pub fn generateZirData(self: Autodoc) !void { | 24 | pub fn generateZirData(self: *Autodoc) !void { |
| 18 | const gpa = self.module.gpa; | 25 | if (self.doc_location) |loc| { |
| 19 | std.debug.print("yay, you called me!\n", .{}); | 26 | if (loc.directory) |dir| { |
| 20 | if (self.doc_location.directory) |dir| { | 27 | if (dir.path) |path| { |
| 21 | if (dir.path) |path| { | 28 | std.debug.print("path: {s}\n", .{path}); |
| 22 | std.debug.print("path: {s}\n", .{path}); | 29 | } |
| 23 | } | 30 | } |
| 24 | } | 31 | } |
| 25 | std.debug.print("basename: {s}\n", .{self.doc_location.basename}); | 32 | std.debug.print("basename: {s}\n", .{self.doc_location.basename}); |
| ... | @@ -31,28 +38,21 @@ pub fn generateZirData(self: Autodoc) !void { | ... | @@ -31,28 +38,21 @@ pub fn generateZirData(self: Autodoc) !void { |
| 31 | else | 38 | else |
| 32 | std.os.getcwd(&buf) catch unreachable; | 39 | std.os.getcwd(&buf) catch unreachable; |
| 33 | const root_file_path = self.module.main_pkg.root_src_path; | 40 | const root_file_path = self.module.main_pkg.root_src_path; |
| 34 | const abs_root_path = try std.fs.path.join(gpa, &.{ dir, root_file_path }); | 41 | const abs_root_path = try std.fs.path.join(self.arena, &.{ dir, root_file_path }); |
| 35 | defer gpa.free(abs_root_path); | 42 | defer self.arena.free(abs_root_path); |
| 36 | const zir = self.module.import_table.get(abs_root_path).?.zir; | 43 | const zir = self.module.import_table.get(abs_root_path).?.zir; |
| 37 | | 44 | |
| 38 | var types = std.ArrayList(DocData.Type).init(gpa); | | |
| 39 | var decls = std.ArrayList(DocData.Decl).init(gpa); | | |
| 40 | var ast_nodes = std.ArrayList(DocData.AstNode).init(gpa); | | |
| 41 | | | |
| 42 | // var decl_map = std.AutoHashMap(Zir.Inst.Index, usize); // values are positions in the `decls` array | 45 | // var decl_map = std.AutoHashMap(Zir.Inst.Index, usize); // values are positions in the `decls` array |
| 43 | | 46 | |
| 44 | try types.append(.{ | | |
| 45 | .kind = 0, | | |
| 46 | .name = "type", | | |
| 47 | }); | | |
| 48 | // append all the types in Zir.Inst.Ref | 47 | // append all the types in Zir.Inst.Ref |
| 49 | { | 48 | { |
| 50 | // we don't count .none | 49 | |
| | 50 | // TODO: we don't want to add .none, but the index math has to check out |
| 51 | var i: u32 = 1; | 51 | var i: u32 = 1; |
| 52 | while (i <= @enumToInt(Zir.Inst.Ref.anyerror_void_error_union_type)) : (i += 1) { | 52 | while (i <= @enumToInt(Zir.Inst.Ref.anyerror_void_error_union_type)) : (i += 1) { |
| 53 | var tmpbuf = std.ArrayList(u8).init(gpa); | 53 | var tmpbuf = std.ArrayList(u8).init(self.arena); |
| 54 | try Zir.Inst.Ref.typed_value_map[i].val.format("", .{}, tmpbuf.writer()); | 54 | try Zir.Inst.Ref.typed_value_map[i].val.format("", .{}, tmpbuf.writer()); |
| 55 | try types.append(.{ | 55 | try self.types.append(self.arena, .{ |
| 56 | .kind = 0, | 56 | .kind = 0, |
| 57 | .name = tmpbuf.toOwnedSlice(), | 57 | .name = tmpbuf.toOwnedSlice(), |
| 58 | }); | 58 | }); |
| ... | @@ -60,14 +60,14 @@ pub fn generateZirData(self: Autodoc) !void { | ... | @@ -60,14 +60,14 @@ pub fn generateZirData(self: Autodoc) !void { |
| 60 | } | 60 | } |
| 61 | | 61 | |
| 62 | var root_scope: Scope = .{ .parent = null }; | 62 | var root_scope: Scope = .{ .parent = null }; |
| 63 | try ast_nodes.append(.{ .name = "(root)" }); | 63 | try self.ast_nodes.append(self.arena, .{ .name = "(root)" }); |
| 64 | const main_type_index = try walkInstruction(zir, gpa, &root_scope, &types, &decls, &ast_nodes, Zir.main_struct_inst); | 64 | const main_type_index = try self.walkInstruction(zir, &root_scope, Zir.main_struct_inst); |
| 65 | | 65 | |
| 66 | var data = DocData{ | 66 | var data = DocData{ |
| 67 | .files = &[1][]const u8{root_file_path}, | 67 | .files = &[1][]const u8{root_file_path}, |
| 68 | .types = types.items, | 68 | .types = self.types.items, |
| 69 | .decls = decls.items, | 69 | .decls = self.decls.items, |
| 70 | .astNodes = ast_nodes.items, | 70 | .astNodes = self.ast_nodes.items, |
| 71 | }; | 71 | }; |
| 72 | | 72 | |
| 73 | data.packages[0].main = main_type_index.type; | 73 | data.packages[0].main = main_type_index.type; |
| ... | @@ -122,11 +122,11 @@ const Scope = struct { | ... | @@ -122,11 +122,11 @@ const Scope = struct { |
| 122 | | 122 | |
| 123 | pub fn insertDeclRef( | 123 | pub fn insertDeclRef( |
| 124 | self: *Scope, | 124 | self: *Scope, |
| 125 | gpa: std.mem.Allocator, | 125 | arena: std.mem.Allocator, |
| 126 | decl_name_index: u32, // decl name | 126 | decl_name_index: u32, // decl name |
| 127 | decls_slot_index: usize, | 127 | decls_slot_index: usize, |
| 128 | ) !void { | 128 | ) !void { |
| 129 | try self.map.put(gpa, decl_name_index, decls_slot_index); | 129 | try self.map.put(arena, decl_name_index, decls_slot_index); |
| 130 | } | 130 | } |
| 131 | }; | 131 | }; |
| 132 | | 132 | |
| ... | @@ -221,19 +221,16 @@ const DocData = struct { | ... | @@ -221,19 +221,16 @@ const DocData = struct { |
| 221 | }; | 221 | }; |
| 222 | | 222 | |
| 223 | fn walkInstruction( | 223 | fn walkInstruction( |
| | 224 | self: *Autodoc, |
| 224 | zir: Zir, | 225 | zir: Zir, |
| 225 | gpa: std.mem.Allocator, | | |
| 226 | parent_scope: *Scope, | 226 | parent_scope: *Scope, |
| 227 | types: *std.ArrayList(DocData.Type), | | |
| 228 | decls: *std.ArrayList(DocData.Decl), | | |
| 229 | ast_nodes: *std.ArrayList(DocData.AstNode), | | |
| 230 | inst_index: usize, | 227 | inst_index: usize, |
| 231 | ) error{OutOfMemory}!DocData.WalkResult { | 228 | ) error{OutOfMemory}!DocData.WalkResult { |
| 232 | const tags = zir.instructions.items(.tag); | 229 | const tags = zir.instructions.items(.tag); |
| 233 | const data = zir.instructions.items(.data); | 230 | const data = zir.instructions.items(.data); |
| 234 | | 231 | |
| 235 | // We assume that the topmost ast_node entry corresponds to our decl | 232 | // We assume that the topmost ast_node entry corresponds to our decl |
| 236 | const self_ast_node_index = ast_nodes.items.len - 1; | 233 | const self_ast_node_index = self.ast_nodes.items.len - 1; |
| 237 | | 234 | |
| 238 | switch (tags[inst_index]) { | 235 | switch (tags[inst_index]) { |
| 239 | else => { | 236 | else => { |
| ... | @@ -252,13 +249,13 @@ fn walkInstruction( | ... | @@ -252,13 +249,13 @@ fn walkInstruction( |
| 252 | const int_type = data[inst_index].int_type; | 249 | const int_type = data[inst_index].int_type; |
| 253 | const sign = if (int_type.signedness == .unsigned) "u" else "i"; | 250 | const sign = if (int_type.signedness == .unsigned) "u" else "i"; |
| 254 | const bits = int_type.bit_count; | 251 | const bits = int_type.bit_count; |
| 255 | const name = try std.fmt.allocPrint(gpa, "{s}{}", .{ sign, bits }); | 252 | const name = try std.fmt.allocPrint(self.arena, "{s}{}", .{ sign, bits }); |
| 256 | | 253 | |
| 257 | try types.append(.{ | 254 | try self.types.append(self.arena, .{ |
| 258 | .kind = @enumToInt(std.builtin.TypeId.Int), | 255 | .kind = @enumToInt(std.builtin.TypeId.Int), |
| 259 | .name = name, | 256 | .name = name, |
| 260 | }); | 257 | }); |
| 261 | return DocData.WalkResult{ .type = types.items.len - 1 }; | 258 | return DocData.WalkResult{ .type = self.types.items.len - 1 }; |
| 262 | }, | 259 | }, |
| 263 | .block_inline => { | 260 | .block_inline => { |
| 264 | const pl_node = data[inst_index].pl_node; | 261 | const pl_node = data[inst_index].pl_node; |
| ... | @@ -273,7 +270,7 @@ fn walkInstruction( | ... | @@ -273,7 +270,7 @@ fn walkInstruction( |
| 273 | | 270 | |
| 274 | const break_operand = data[break_index].@"break".operand; | 271 | const break_operand = data[break_index].@"break".operand; |
| 275 | return if (Zir.refToIndex(break_operand)) |bi| | 272 | return if (Zir.refToIndex(break_operand)) |bi| |
| 276 | walkInstruction(zir, gpa, parent_scope, types, decls, ast_nodes, bi) | 273 | self.walkInstruction(zir, parent_scope, bi) |
| 277 | else if (@enumToInt(break_operand) <= @enumToInt(Zir.Inst.Ref.anyerror_void_error_union_type)) | 274 | else if (@enumToInt(break_operand) <= @enumToInt(Zir.Inst.Ref.anyerror_void_error_union_type)) |
| 278 | // we append all the types in ref first, so we can just do this if we encounter a ref that is a type | 275 | // we append all the types in ref first, so we can just do this if we encounter a ref that is a type |
| 279 | return DocData.WalkResult{ .type = @enumToInt(break_operand) } | 276 | return DocData.WalkResult{ .type = @enumToInt(break_operand) } |
| ... | @@ -322,58 +319,50 @@ fn walkInstruction( | ... | @@ -322,58 +319,50 @@ fn walkInstruction( |
| 322 | break :blk decls_len; | 319 | break :blk decls_len; |
| 323 | } else 0; | 320 | } else 0; |
| 324 | | 321 | |
| 325 | var decl_indexes = std.ArrayList(usize).init(gpa); | 322 | var decl_indexes: std.ArrayListUnmanaged(usize) = .{}; |
| 326 | var priv_decl_indexes = std.ArrayList(usize).init(gpa); | 323 | var priv_decl_indexes: std.ArrayListUnmanaged(usize) = .{}; |
| 327 | | 324 | |
| 328 | const decls_first_index = decls.items.len; | 325 | const decls_first_index = self.decls.items.len; |
| 329 | // Decl name lookahead for reserving slots in `scope` (and `decls`). | 326 | // Decl name lookahead for reserving slots in `scope` (and `decls`). |
| 330 | // Done to make sure that all decl refs can be resolved correctly, | 327 | // Done to make sure that all decl refs can be resolved correctly, |
| 331 | // even if we haven't fully analyzed the decl yet. | 328 | // even if we haven't fully analyzed the decl yet. |
| 332 | { | 329 | { |
| 333 | var it = zir.declIterator(@intCast(u32, inst_index)); | 330 | var it = zir.declIterator(@intCast(u32, inst_index)); |
| 334 | try decls.resize(decls_first_index + it.decls_len); | 331 | try self.decls.resize(self.arena, decls_first_index + it.decls_len); |
| 335 | var decls_slot_index = decls_first_index; | 332 | var decls_slot_index = decls_first_index; |
| 336 | while (it.next()) |d| : (decls_slot_index += 1) { | 333 | while (it.next()) |d| : (decls_slot_index += 1) { |
| 337 | const decl_name_index = zir.extra[d.sub_index + 5]; | 334 | const decl_name_index = zir.extra[d.sub_index + 5]; |
| 338 | try scope.insertDeclRef(gpa, decl_name_index, decls_slot_index); | 335 | try scope.insertDeclRef(self.arena, decl_name_index, decls_slot_index); |
| 339 | } | 336 | } |
| 340 | } | 337 | } |
| 341 | | 338 | |
| 342 | extra_index = try walkDecls( | 339 | extra_index = try self.walkDecls( |
| 343 | zir, | 340 | zir, |
| 344 | gpa, | | |
| 345 | &scope, | 341 | &scope, |
| 346 | decls, | | |
| 347 | decls_first_index, | 342 | decls_first_index, |
| 348 | decls_len, | 343 | decls_len, |
| 349 | &decl_indexes, | 344 | &decl_indexes, |
| 350 | &priv_decl_indexes, | 345 | &priv_decl_indexes, |
| 351 | types, | | |
| 352 | ast_nodes, | | |
| 353 | extra_index, | 346 | extra_index, |
| 354 | ); | 347 | ); |
| 355 | | 348 | |
| 356 | // const body = zir.extra[extra_index..][0..body_len]; | 349 | // const body = zir.extra[extra_index..][0..body_len]; |
| 357 | extra_index += body_len; | 350 | extra_index += body_len; |
| 358 | | 351 | |
| 359 | var field_type_indexes = std.ArrayList(DocData.WalkResult).init(gpa); | 352 | var field_type_indexes: std.ArrayListUnmanaged(DocData.WalkResult) = .{}; |
| 360 | var field_name_indexes = std.ArrayList(usize).init(gpa); | 353 | var field_name_indexes: std.ArrayListUnmanaged(usize) = .{}; |
| 361 | try collectFieldInfo( | 354 | try self.collectFieldInfo( |
| 362 | zir, | 355 | zir, |
| 363 | gpa, | | |
| 364 | &scope, | 356 | &scope, |
| 365 | types, | | |
| 366 | decls, | | |
| 367 | fields_len, | 357 | fields_len, |
| 368 | &field_type_indexes, | 358 | &field_type_indexes, |
| 369 | &field_name_indexes, | 359 | &field_name_indexes, |
| 370 | ast_nodes, | | |
| 371 | extra_index, | 360 | extra_index, |
| 372 | ); | 361 | ); |
| 373 | | 362 | |
| 374 | ast_nodes.items[self_ast_node_index].fields = field_name_indexes.items; | 363 | self.ast_nodes.items[self_ast_node_index].fields = field_name_indexes.items; |
| 375 | | 364 | |
| 376 | try types.append(.{ | 365 | try self.types.append(self.arena, .{ |
| 377 | .kind = @enumToInt(std.builtin.TypeId.Struct), | 366 | .kind = @enumToInt(std.builtin.TypeId.Struct), |
| 378 | .name = "todo_name", | 367 | .name = "todo_name", |
| 379 | .src = self_ast_node_index, | 368 | .src = self_ast_node_index, |
| ... | @@ -382,7 +371,7 @@ fn walkInstruction( | ... | @@ -382,7 +371,7 @@ fn walkInstruction( |
| 382 | .fields = field_type_indexes.items, | 371 | .fields = field_type_indexes.items, |
| 383 | }); | 372 | }); |
| 384 | | 373 | |
| 385 | return DocData.WalkResult{ .type = types.items.len - 1 }; | 374 | return DocData.WalkResult{ .type = self.types.items.len - 1 }; |
| 386 | }, | 375 | }, |
| 387 | } | 376 | } |
| 388 | }, | 377 | }, |
| ... | @@ -390,16 +379,13 @@ fn walkInstruction( | ... | @@ -390,16 +379,13 @@ fn walkInstruction( |
| 390 | } | 379 | } |
| 391 | | 380 | |
| 392 | fn walkDecls( | 381 | fn walkDecls( |
| | 382 | self: *Autodoc, |
| 393 | zir: Zir, | 383 | zir: Zir, |
| 394 | gpa: std.mem.Allocator, | | |
| 395 | scope: *Scope, | 384 | scope: *Scope, |
| 396 | decls: *std.ArrayList(DocData.Decl), | | |
| 397 | decls_first_index: usize, | 385 | decls_first_index: usize, |
| 398 | decls_len: u32, | 386 | decls_len: u32, |
| 399 | decl_indexes: *std.ArrayList(usize), | 387 | decl_indexes: *std.ArrayListUnmanaged(usize), |
| 400 | priv_decl_indexes: *std.ArrayList(usize), | 388 | priv_decl_indexes: *std.ArrayListUnmanaged(usize), |
| 401 | types: *std.ArrayList(DocData.Type), | | |
| 402 | ast_nodes: *std.ArrayList(DocData.AstNode), | | |
| 403 | extra_start: usize, | 389 | extra_start: usize, |
| 404 | ) error{OutOfMemory}!usize { | 390 | ) error{OutOfMemory}!usize { |
| 405 | const bit_bags_count = std.math.divCeil(usize, decls_len, 8) catch unreachable; | 391 | const bit_bags_count = std.math.divCeil(usize, decls_len, 8) catch unreachable; |
| ... | @@ -478,8 +464,8 @@ fn walkDecls( | ... | @@ -478,8 +464,8 @@ fn walkDecls( |
| 478 | | 464 | |
| 479 | // astnode | 465 | // astnode |
| 480 | const ast_node_index = idx: { | 466 | const ast_node_index = idx: { |
| 481 | const idx = ast_nodes.items.len; | 467 | const idx = self.ast_nodes.items.len; |
| 482 | try ast_nodes.append(.{ | 468 | try self.ast_nodes.append(self.arena, .{ |
| 483 | .file = 0, | 469 | .file = 0, |
| 484 | .line = 0, | 470 | .line = 0, |
| 485 | .col = 0, | 471 | .col = 0, |
| ... | @@ -489,16 +475,16 @@ fn walkDecls( | ... | @@ -489,16 +475,16 @@ fn walkDecls( |
| 489 | break :idx idx; | 475 | break :idx idx; |
| 490 | }; | 476 | }; |
| 491 | | 477 | |
| 492 | const walk_result = try walkInstruction(zir, gpa, scope, types, decls, ast_nodes, decl_index); | 478 | const walk_result = try self.walkInstruction(zir, scope, decl_index); |
| 493 | const type_index = walk_result.type; | 479 | const type_index = walk_result.type; |
| 494 | | 480 | |
| 495 | if (is_pub) { | 481 | if (is_pub) { |
| 496 | try decl_indexes.append(decls_slot_index); | 482 | try decl_indexes.append(self.arena, decls_slot_index); |
| 497 | } else { | 483 | } else { |
| 498 | try priv_decl_indexes.append(decls_slot_index); | 484 | try priv_decl_indexes.append(self.arena, decls_slot_index); |
| 499 | } | 485 | } |
| 500 | | 486 | |
| 501 | decls.items[decls_slot_index] = .{ | 487 | self.decls.items[decls_slot_index] = .{ |
| 502 | .name = name, | 488 | .name = name, |
| 503 | .src = ast_node_index, | 489 | .src = ast_node_index, |
| 504 | .type = 0, | 490 | .type = 0, |
| ... | @@ -511,15 +497,12 @@ fn walkDecls( | ... | @@ -511,15 +497,12 @@ fn walkDecls( |
| 511 | } | 497 | } |
| 512 | | 498 | |
| 513 | fn collectFieldInfo( | 499 | fn collectFieldInfo( |
| | 500 | self: *Autodoc, |
| 514 | zir: Zir, | 501 | zir: Zir, |
| 515 | gpa: std.mem.Allocator, | | |
| 516 | scope: *Scope, | 502 | scope: *Scope, |
| 517 | types: *std.ArrayList(DocData.Type), | | |
| 518 | decls: *std.ArrayList(DocData.Decl), | | |
| 519 | fields_len: usize, | 503 | fields_len: usize, |
| 520 | field_type_indexes: *std.ArrayList(DocData.WalkResult), | 504 | field_type_indexes: *std.ArrayListUnmanaged(DocData.WalkResult), |
| 521 | field_name_indexes: *std.ArrayList(usize), | 505 | field_name_indexes: *std.ArrayListUnmanaged(usize), |
| 522 | ast_nodes: *std.ArrayList(DocData.AstNode), | | |
| 523 | ei: usize, | 506 | ei: usize, |
| 524 | ) !void { | 507 | ) !void { |
| 525 | if (fields_len == 0) return; | 508 | if (fields_len == 0) return; |
| ... | @@ -559,15 +542,17 @@ fn collectFieldInfo( | ... | @@ -559,15 +542,17 @@ fn collectFieldInfo( |
| 559 | { | 542 | { |
| 560 | switch (field_type) { | 543 | switch (field_type) { |
| 561 | .void_type => { | 544 | .void_type => { |
| 562 | try field_type_indexes.append(.{ .type = types.items.len }); | 545 | try field_type_indexes.append(self.arena, .{ |
| 563 | try types.append(.{ | 546 | .type = self.types.items.len, |
| | 547 | }); |
| | 548 | try self.types.append(self.arena, .{ |
| 564 | .kind = @enumToInt(std.builtin.TypeId.Void), | 549 | .kind = @enumToInt(std.builtin.TypeId.Void), |
| 565 | .name = "void", | 550 | .name = "void", |
| 566 | }); | 551 | }); |
| 567 | }, | 552 | }, |
| 568 | .usize_type => { | 553 | .usize_type => { |
| 569 | try field_type_indexes.append(.{ .type = types.items.len }); | 554 | try field_type_indexes.append(self.arena, .{ .type = self.types.items.len }); |
| 570 | try types.append(.{ | 555 | try self.types.append(self.arena, .{ |
| 571 | .kind = @enumToInt(std.builtin.TypeId.Int), | 556 | .kind = @enumToInt(std.builtin.TypeId.Int), |
| 572 | .name = "usize", | 557 | .name = "usize", |
| 573 | }); | 558 | }); |
| ... | @@ -580,19 +565,18 @@ fn collectFieldInfo( | ... | @@ -580,19 +565,18 @@ fn collectFieldInfo( |
| 580 | "TODO: handle ref type: {s}", | 565 | "TODO: handle ref type: {s}", |
| 581 | .{@tagName(field_type)}, | 566 | .{@tagName(field_type)}, |
| 582 | ); | 567 | ); |
| 583 | try field_type_indexes.append(DocData.WalkResult{ .failure = true }); | 568 | try field_type_indexes.append( |
| | 569 | self.arena, |
| | 570 | DocData.WalkResult{ .failure = true }, |
| | 571 | ); |
| 584 | } else { | 572 | } else { |
| 585 | const zir_index = enum_value - Zir.Inst.Ref.typed_value_map.len; | 573 | const zir_index = enum_value - Zir.Inst.Ref.typed_value_map.len; |
| 586 | const walk_result = try walkInstruction( | 574 | const walk_result = try self.walkInstruction( |
| 587 | zir, | 575 | zir, |
| 588 | gpa, | | |
| 589 | scope, | 576 | scope, |
| 590 | types, | | |
| 591 | decls, | | |
| 592 | ast_nodes, | | |
| 593 | zir_index, | 577 | zir_index, |
| 594 | ); | 578 | ); |
| 595 | try field_type_indexes.append(walk_result); | 579 | try field_type_indexes.append(self.arena, walk_result); |
| 596 | } | 580 | } |
| 597 | }, | 581 | }, |
| 598 | } | 582 | } |
| ... | @@ -600,12 +584,12 @@ fn collectFieldInfo( | ... | @@ -600,12 +584,12 @@ fn collectFieldInfo( |
| 600 | | 584 | |
| 601 | // ast node | 585 | // ast node |
| 602 | { | 586 | { |
| 603 | try field_name_indexes.append(ast_nodes.items.len); | 587 | try field_name_indexes.append(self.arena, self.ast_nodes.items.len); |
| 604 | const doc_comment: ?[]const u8 = if (doc_comment_index != 0) | 588 | const doc_comment: ?[]const u8 = if (doc_comment_index != 0) |
| 605 | zir.nullTerminatedString(doc_comment_index) | 589 | zir.nullTerminatedString(doc_comment_index) |
| 606 | else | 590 | else |
| 607 | null; | 591 | null; |
| 608 | try ast_nodes.append(.{ | 592 | try self.ast_nodes.append(self.arena, .{ |
| 609 | .name = field_name, | 593 | .name = field_name, |
| 610 | .docs = doc_comment, | 594 | .docs = doc_comment, |
| 611 | }); | 595 | }); |