| ... | ... | @@ -16813,9 +16813,6 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16813 | 16813 | .val = .void_value, |
| 16814 | 16814 | } }))), |
| 16815 | 16815 | .Fn => { |
| 16816 | | var params_anon_decl = try block.startAnonDecl(); |
| 16817 | | defer params_anon_decl.deinit(); |
| 16818 | | |
| 16819 | 16816 | const fn_info_decl_index = (try sema.namespaceLookup( |
| 16820 | 16817 | block, |
| 16821 | 16818 | src, |
| ... | ... | @@ -16872,23 +16869,23 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16872 | 16869 | .len = param_vals.len, |
| 16873 | 16870 | .child = param_info_ty.toIntern(), |
| 16874 | 16871 | }); |
| 16875 | | const new_decl = try params_anon_decl.finish( |
| 16876 | | new_decl_ty, |
| 16877 | | (try mod.intern(.{ .aggregate = .{ |
| 16878 | | .ty = new_decl_ty.toIntern(), |
| 16879 | | .storage = .{ .elems = param_vals }, |
| 16880 | | } })).toValue(), |
| 16881 | | .none, // default alignment |
| 16882 | | ); |
| 16872 | const new_decl_val = try mod.intern(.{ .aggregate = .{ |
| 16873 | .ty = new_decl_ty.toIntern(), |
| 16874 | .storage = .{ .elems = param_vals }, |
| 16875 | } }); |
| 16876 | const ptr_ty = (try sema.ptrType(.{ |
| 16877 | .child = param_info_ty.toIntern(), |
| 16878 | .flags = .{ |
| 16879 | .size = .Slice, |
| 16880 | .is_const = true, |
| 16881 | }, |
| 16882 | })).toIntern(); |
| 16883 | 16883 | break :v try mod.intern(.{ .ptr = .{ |
| 16884 | | .ty = (try sema.ptrType(.{ |
| 16885 | | .child = param_info_ty.toIntern(), |
| 16886 | | .flags = .{ |
| 16887 | | .size = .Slice, |
| 16888 | | .is_const = true, |
| 16889 | | }, |
| 16890 | | })).toIntern(), |
| 16891 | | .addr = .{ .decl = new_decl }, |
| 16884 | .ty = ptr_ty, |
| 16885 | .addr = .{ .anon_decl = .{ |
| 16886 | .orig_ty = ptr_ty, |
| 16887 | .val = new_decl_val, |
| 16888 | } }, |
| 16892 | 16889 | .len = (try mod.intValue(Type.usize, param_vals.len)).toIntern(), |
| 16893 | 16890 | } }); |
| 16894 | 16891 | }; |
| ... | ... | @@ -17133,9 +17130,6 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17133 | 17130 | } }))); |
| 17134 | 17131 | }, |
| 17135 | 17132 | .ErrorSet => { |
| 17136 | | var fields_anon_decl = try block.startAnonDecl(); |
| 17137 | | defer fields_anon_decl.deinit(); |
| 17138 | | |
| 17139 | 17133 | // Get the Error type |
| 17140 | 17134 | const error_field_ty = t: { |
| 17141 | 17135 | const set_field_ty_decl_index = (try sema.namespaceLookup( |
| ... | ... | @@ -17164,23 +17158,20 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17164 | 17158 | // TODO: write something like getCoercedInts to avoid needing to dupe |
| 17165 | 17159 | const name = try sema.arena.dupe(u8, ip.stringToSlice(names.get(ip)[i])); |
| 17166 | 17160 | const name_val = v: { |
| 17167 | | var anon_decl = try block.startAnonDecl(); |
| 17168 | | defer anon_decl.deinit(); |
| 17169 | 17161 | const new_decl_ty = try mod.arrayType(.{ |
| 17170 | 17162 | .len = name.len, |
| 17171 | 17163 | .child = .u8_type, |
| 17172 | 17164 | }); |
| 17173 | | const new_decl = try anon_decl.finish( |
| 17174 | | new_decl_ty, |
| 17175 | | (try mod.intern(.{ .aggregate = .{ |
| 17176 | | .ty = new_decl_ty.toIntern(), |
| 17177 | | .storage = .{ .bytes = name }, |
| 17178 | | } })).toValue(), |
| 17179 | | .none, // default alignment |
| 17180 | | ); |
| 17165 | const new_decl_val = try mod.intern(.{ .aggregate = .{ |
| 17166 | .ty = new_decl_ty.toIntern(), |
| 17167 | .storage = .{ .bytes = name }, |
| 17168 | } }); |
| 17181 | 17169 | break :v try mod.intern(.{ .ptr = .{ |
| 17182 | 17170 | .ty = .slice_const_u8_type, |
| 17183 | | .addr = .{ .decl = new_decl }, |
| 17171 | .addr = .{ .anon_decl = .{ |
| 17172 | .val = new_decl_val, |
| 17173 | .orig_ty = .slice_const_u8_type, |
| 17174 | } }, |
| 17184 | 17175 | .len = (try mod.intValue(Type.usize, name.len)).toIntern(), |
| 17185 | 17176 | } }); |
| 17186 | 17177 | }; |
| ... | ... | @@ -17213,17 +17204,16 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17213 | 17204 | .len = vals.len, |
| 17214 | 17205 | .child = error_field_ty.toIntern(), |
| 17215 | 17206 | }); |
| 17216 | | const new_decl = try fields_anon_decl.finish( |
| 17217 | | array_errors_ty, |
| 17218 | | (try mod.intern(.{ .aggregate = .{ |
| 17219 | | .ty = array_errors_ty.toIntern(), |
| 17220 | | .storage = .{ .elems = vals }, |
| 17221 | | } })).toValue(), |
| 17222 | | .none, // default alignment |
| 17223 | | ); |
| 17207 | const new_decl_val = try mod.intern(.{ .aggregate = .{ |
| 17208 | .ty = array_errors_ty.toIntern(), |
| 17209 | .storage = .{ .elems = vals }, |
| 17210 | } }); |
| 17224 | 17211 | break :v try mod.intern(.{ .ptr = .{ |
| 17225 | 17212 | .ty = slice_errors_ty.toIntern(), |
| 17226 | | .addr = .{ .decl = new_decl }, |
| 17213 | .addr = .{ .anon_decl = .{ |
| 17214 | .orig_ty = slice_errors_ty.toIntern(), |
| 17215 | .val = new_decl_val, |
| 17216 | } }, |
| 17227 | 17217 | .len = (try mod.intValue(Type.usize, vals.len)).toIntern(), |
| 17228 | 17218 | } }); |
| 17229 | 17219 | } else .none; |
| ... | ... | @@ -17271,9 +17261,6 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17271 | 17261 | .Enum => { |
| 17272 | 17262 | const is_exhaustive = Value.makeBool(ip.indexToKey(ty.toIntern()).enum_type.tag_mode != .nonexhaustive); |
| 17273 | 17263 | |
| 17274 | | var fields_anon_decl = try block.startAnonDecl(); |
| 17275 | | defer fields_anon_decl.deinit(); |
| 17276 | | |
| 17277 | 17264 | const enum_field_ty = t: { |
| 17278 | 17265 | const enum_field_ty_decl_index = (try sema.namespaceLookup( |
| 17279 | 17266 | block, |
| ... | ... | @@ -17301,23 +17288,20 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17301 | 17288 | // TODO: write something like getCoercedInts to avoid needing to dupe |
| 17302 | 17289 | const name = try sema.arena.dupe(u8, ip.stringToSlice(enum_type.names.get(ip)[i])); |
| 17303 | 17290 | const name_val = v: { |
| 17304 | | var anon_decl = try block.startAnonDecl(); |
| 17305 | | defer anon_decl.deinit(); |
| 17306 | 17291 | const new_decl_ty = try mod.arrayType(.{ |
| 17307 | 17292 | .len = name.len, |
| 17308 | 17293 | .child = .u8_type, |
| 17309 | 17294 | }); |
| 17310 | | const new_decl = try anon_decl.finish( |
| 17311 | | new_decl_ty, |
| 17312 | | (try mod.intern(.{ .aggregate = .{ |
| 17313 | | .ty = new_decl_ty.toIntern(), |
| 17314 | | .storage = .{ .bytes = name }, |
| 17315 | | } })).toValue(), |
| 17316 | | .none, // default alignment |
| 17317 | | ); |
| 17295 | const new_decl_val = try mod.intern(.{ .aggregate = .{ |
| 17296 | .ty = new_decl_ty.toIntern(), |
| 17297 | .storage = .{ .bytes = name }, |
| 17298 | } }); |
| 17318 | 17299 | break :v try mod.intern(.{ .ptr = .{ |
| 17319 | 17300 | .ty = .slice_const_u8_type, |
| 17320 | | .addr = .{ .decl = new_decl }, |
| 17301 | .addr = .{ .anon_decl = .{ |
| 17302 | .val = new_decl_val, |
| 17303 | .orig_ty = .slice_const_u8_type, |
| 17304 | } }, |
| 17321 | 17305 | .len = (try mod.intValue(Type.usize, name.len)).toIntern(), |
| 17322 | 17306 | } }); |
| 17323 | 17307 | }; |
| ... | ... | @@ -17339,23 +17323,23 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17339 | 17323 | .len = enum_field_vals.len, |
| 17340 | 17324 | .child = enum_field_ty.toIntern(), |
| 17341 | 17325 | }); |
| 17342 | | const new_decl = try fields_anon_decl.finish( |
| 17343 | | fields_array_ty, |
| 17344 | | (try mod.intern(.{ .aggregate = .{ |
| 17345 | | .ty = fields_array_ty.toIntern(), |
| 17346 | | .storage = .{ .elems = enum_field_vals }, |
| 17347 | | } })).toValue(), |
| 17348 | | .none, // default alignment |
| 17349 | | ); |
| 17326 | const new_decl_val = try mod.intern(.{ .aggregate = .{ |
| 17327 | .ty = fields_array_ty.toIntern(), |
| 17328 | .storage = .{ .elems = enum_field_vals }, |
| 17329 | } }); |
| 17330 | const ptr_ty = (try sema.ptrType(.{ |
| 17331 | .child = enum_field_ty.toIntern(), |
| 17332 | .flags = .{ |
| 17333 | .size = .Slice, |
| 17334 | .is_const = true, |
| 17335 | }, |
| 17336 | })).toIntern(); |
| 17350 | 17337 | break :v try mod.intern(.{ .ptr = .{ |
| 17351 | | .ty = (try sema.ptrType(.{ |
| 17352 | | .child = enum_field_ty.toIntern(), |
| 17353 | | .flags = .{ |
| 17354 | | .size = .Slice, |
| 17355 | | .is_const = true, |
| 17356 | | }, |
| 17357 | | })).toIntern(), |
| 17358 | | .addr = .{ .decl = new_decl }, |
| 17338 | .ty = ptr_ty, |
| 17339 | .addr = .{ .anon_decl = .{ |
| 17340 | .val = new_decl_val, |
| 17341 | .orig_ty = ptr_ty, |
| 17342 | } }, |
| 17359 | 17343 | .len = (try mod.intValue(Type.usize, enum_field_vals.len)).toIntern(), |
| 17360 | 17344 | } }); |
| 17361 | 17345 | }; |
| ... | ... | @@ -17395,9 +17379,6 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17395 | 17379 | } }))); |
| 17396 | 17380 | }, |
| 17397 | 17381 | .Union => { |
| 17398 | | var fields_anon_decl = try block.startAnonDecl(); |
| 17399 | | defer fields_anon_decl.deinit(); |
| 17400 | | |
| 17401 | 17382 | const type_union_ty = t: { |
| 17402 | 17383 | const type_union_ty_decl_index = (try sema.namespaceLookup( |
| 17403 | 17384 | block, |
| ... | ... | @@ -17435,23 +17416,20 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17435 | 17416 | // TODO: write something like getCoercedInts to avoid needing to dupe |
| 17436 | 17417 | const name = try sema.arena.dupe(u8, ip.stringToSlice(union_obj.field_names.get(ip)[i])); |
| 17437 | 17418 | const name_val = v: { |
| 17438 | | var anon_decl = try block.startAnonDecl(); |
| 17439 | | defer anon_decl.deinit(); |
| 17440 | 17419 | const new_decl_ty = try mod.arrayType(.{ |
| 17441 | 17420 | .len = name.len, |
| 17442 | 17421 | .child = .u8_type, |
| 17443 | 17422 | }); |
| 17444 | | const new_decl = try anon_decl.finish( |
| 17445 | | new_decl_ty, |
| 17446 | | (try mod.intern(.{ .aggregate = .{ |
| 17447 | | .ty = new_decl_ty.toIntern(), |
| 17448 | | .storage = .{ .bytes = name }, |
| 17449 | | } })).toValue(), |
| 17450 | | .none, // default alignment |
| 17451 | | ); |
| 17423 | const new_decl_val = try mod.intern(.{ .aggregate = .{ |
| 17424 | .ty = new_decl_ty.toIntern(), |
| 17425 | .storage = .{ .bytes = name }, |
| 17426 | } }); |
| 17452 | 17427 | break :v try mod.intern(.{ .ptr = .{ |
| 17453 | 17428 | .ty = .slice_const_u8_type, |
| 17454 | | .addr = .{ .decl = new_decl }, |
| 17429 | .addr = .{ .anon_decl = .{ |
| 17430 | .val = new_decl_val, |
| 17431 | .orig_ty = .slice_const_u8_type, |
| 17432 | } }, |
| 17455 | 17433 | .len = (try mod.intValue(Type.usize, name.len)).toIntern(), |
| 17456 | 17434 | } }); |
| 17457 | 17435 | }; |
| ... | ... | @@ -17481,23 +17459,23 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17481 | 17459 | .len = union_field_vals.len, |
| 17482 | 17460 | .child = union_field_ty.toIntern(), |
| 17483 | 17461 | }); |
| 17484 | | const new_decl = try fields_anon_decl.finish( |
| 17485 | | array_fields_ty, |
| 17486 | | (try mod.intern(.{ .aggregate = .{ |
| 17487 | | .ty = array_fields_ty.toIntern(), |
| 17488 | | .storage = .{ .elems = union_field_vals }, |
| 17489 | | } })).toValue(), |
| 17490 | | .none, // default alignment |
| 17491 | | ); |
| 17462 | const new_decl_val = try mod.intern(.{ .aggregate = .{ |
| 17463 | .ty = array_fields_ty.toIntern(), |
| 17464 | .storage = .{ .elems = union_field_vals }, |
| 17465 | } }); |
| 17466 | const ptr_ty = (try sema.ptrType(.{ |
| 17467 | .child = union_field_ty.toIntern(), |
| 17468 | .flags = .{ |
| 17469 | .size = .Slice, |
| 17470 | .is_const = true, |
| 17471 | }, |
| 17472 | })).toIntern(); |
| 17492 | 17473 | break :v try mod.intern(.{ .ptr = .{ |
| 17493 | | .ty = (try sema.ptrType(.{ |
| 17494 | | .child = union_field_ty.toIntern(), |
| 17495 | | .flags = .{ |
| 17496 | | .size = .Slice, |
| 17497 | | .is_const = true, |
| 17498 | | }, |
| 17499 | | })).toIntern(), |
| 17500 | | .addr = .{ .decl = new_decl }, |
| 17474 | .ty = ptr_ty, |
| 17475 | .addr = .{ .anon_decl = .{ |
| 17476 | .orig_ty = ptr_ty, |
| 17477 | .val = new_decl_val, |
| 17478 | } }, |
| 17501 | 17479 | .len = (try mod.intValue(Type.usize, union_field_vals.len)).toIntern(), |
| 17502 | 17480 | } }); |
| 17503 | 17481 | }; |
| ... | ... | @@ -17543,9 +17521,6 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17543 | 17521 | } }))); |
| 17544 | 17522 | }, |
| 17545 | 17523 | .Struct => { |
| 17546 | | var fields_anon_decl = try block.startAnonDecl(); |
| 17547 | | defer fields_anon_decl.deinit(); |
| 17548 | | |
| 17549 | 17524 | const type_struct_ty = t: { |
| 17550 | 17525 | const type_struct_ty_decl_index = (try sema.namespaceLookup( |
| 17551 | 17526 | block, |
| ... | ... | @@ -17585,8 +17560,6 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17585 | 17560 | const field_ty = anon_struct_type.types.get(ip)[i]; |
| 17586 | 17561 | const field_val = anon_struct_type.values.get(ip)[i]; |
| 17587 | 17562 | const name_val = v: { |
| 17588 | | var anon_decl = try block.startAnonDecl(); |
| 17589 | | defer anon_decl.deinit(); |
| 17590 | 17563 | // TODO: write something like getCoercedInts to avoid needing to dupe |
| 17591 | 17564 | const bytes = if (tuple.names.len != 0) |
| 17592 | 17565 | // https://github.com/ziglang/zig/issues/15709 |
| ... | ... | @@ -17597,17 +17570,16 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17597 | 17570 | .len = bytes.len, |
| 17598 | 17571 | .child = .u8_type, |
| 17599 | 17572 | }); |
| 17600 | | const new_decl = try anon_decl.finish( |
| 17601 | | new_decl_ty, |
| 17602 | | (try mod.intern(.{ .aggregate = .{ |
| 17603 | | .ty = new_decl_ty.toIntern(), |
| 17604 | | .storage = .{ .bytes = bytes }, |
| 17605 | | } })).toValue(), |
| 17606 | | .none, // default alignment |
| 17607 | | ); |
| 17573 | const new_decl_val = try mod.intern(.{ .aggregate = .{ |
| 17574 | .ty = new_decl_ty.toIntern(), |
| 17575 | .storage = .{ .bytes = bytes }, |
| 17576 | } }); |
| 17608 | 17577 | break :v try mod.intern(.{ .ptr = .{ |
| 17609 | 17578 | .ty = .slice_const_u8_type, |
| 17610 | | .addr = .{ .decl = new_decl }, |
| 17579 | .addr = .{ .anon_decl = .{ |
| 17580 | .val = new_decl_val, |
| 17581 | .orig_ty = .slice_const_u8_type, |
| 17582 | } }, |
| 17611 | 17583 | .len = (try mod.intValue(Type.usize, bytes.len)).toIntern(), |
| 17612 | 17584 | } }); |
| 17613 | 17585 | }; |
| ... | ... | @@ -17651,23 +17623,20 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17651 | 17623 | const field_init = struct_type.fieldInit(ip, i); |
| 17652 | 17624 | const field_is_comptime = struct_type.fieldIsComptime(ip, i); |
| 17653 | 17625 | const name_val = v: { |
| 17654 | | var anon_decl = try block.startAnonDecl(); |
| 17655 | | defer anon_decl.deinit(); |
| 17656 | 17626 | const new_decl_ty = try mod.arrayType(.{ |
| 17657 | 17627 | .len = name.len, |
| 17658 | 17628 | .child = .u8_type, |
| 17659 | 17629 | }); |
| 17660 | | const new_decl = try anon_decl.finish( |
| 17661 | | new_decl_ty, |
| 17662 | | (try mod.intern(.{ .aggregate = .{ |
| 17663 | | .ty = new_decl_ty.toIntern(), |
| 17664 | | .storage = .{ .bytes = name }, |
| 17665 | | } })).toValue(), |
| 17666 | | .none, // default alignment |
| 17667 | | ); |
| 17630 | const new_decl_val = try mod.intern(.{ .aggregate = .{ |
| 17631 | .ty = new_decl_ty.toIntern(), |
| 17632 | .storage = .{ .bytes = name }, |
| 17633 | } }); |
| 17668 | 17634 | break :v try mod.intern(.{ .ptr = .{ |
| 17669 | 17635 | .ty = .slice_const_u8_type, |
| 17670 | | .addr = .{ .decl = new_decl }, |
| 17636 | .addr = .{ .anon_decl = .{ |
| 17637 | .val = new_decl_val, |
| 17638 | .orig_ty = .slice_const_u8_type, |
| 17639 | } }, |
| 17671 | 17640 | .len = (try mod.intValue(Type.usize, name.len)).toIntern(), |
| 17672 | 17641 | } }); |
| 17673 | 17642 | }; |
| ... | ... | @@ -17707,23 +17676,23 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17707 | 17676 | .len = struct_field_vals.len, |
| 17708 | 17677 | .child = struct_field_ty.toIntern(), |
| 17709 | 17678 | }); |
| 17710 | | const new_decl = try fields_anon_decl.finish( |
| 17711 | | array_fields_ty, |
| 17712 | | (try mod.intern(.{ .aggregate = .{ |
| 17713 | | .ty = array_fields_ty.toIntern(), |
| 17714 | | .storage = .{ .elems = struct_field_vals }, |
| 17715 | | } })).toValue(), |
| 17716 | | .none, // default alignment |
| 17717 | | ); |
| 17679 | const new_decl_val = try mod.intern(.{ .aggregate = .{ |
| 17680 | .ty = array_fields_ty.toIntern(), |
| 17681 | .storage = .{ .elems = struct_field_vals }, |
| 17682 | } }); |
| 17683 | const ptr_ty = (try sema.ptrType(.{ |
| 17684 | .child = struct_field_ty.toIntern(), |
| 17685 | .flags = .{ |
| 17686 | .size = .Slice, |
| 17687 | .is_const = true, |
| 17688 | }, |
| 17689 | })).toIntern(); |
| 17718 | 17690 | break :v try mod.intern(.{ .ptr = .{ |
| 17719 | | .ty = (try sema.ptrType(.{ |
| 17720 | | .child = struct_field_ty.toIntern(), |
| 17721 | | .flags = .{ |
| 17722 | | .size = .Slice, |
| 17723 | | .is_const = true, |
| 17724 | | }, |
| 17725 | | })).toIntern(), |
| 17726 | | .addr = .{ .decl = new_decl }, |
| 17691 | .ty = ptr_ty, |
| 17692 | .addr = .{ .anon_decl = .{ |
| 17693 | .orig_ty = ptr_ty, |
| 17694 | .val = new_decl_val, |
| 17695 | } }, |
| 17727 | 17696 | .len = (try mod.intValue(Type.usize, struct_field_vals.len)).toIntern(), |
| 17728 | 17697 | } }); |
| 17729 | 17698 | }; |
| ... | ... | @@ -17819,9 +17788,6 @@ fn typeInfoDecls( |
| 17819 | 17788 | const mod = sema.mod; |
| 17820 | 17789 | const gpa = sema.gpa; |
| 17821 | 17790 | |
| 17822 | | var decls_anon_decl = try block.startAnonDecl(); |
| 17823 | | defer decls_anon_decl.deinit(); |
| 17824 | | |
| 17825 | 17791 | const declaration_ty = t: { |
| 17826 | 17792 | const declaration_ty_decl_index = (try sema.namespaceLookup( |
| 17827 | 17793 | block, |
| ... | ... | @@ -17851,23 +17817,23 @@ fn typeInfoDecls( |
| 17851 | 17817 | .len = decl_vals.items.len, |
| 17852 | 17818 | .child = declaration_ty.toIntern(), |
| 17853 | 17819 | }); |
| 17854 | | const new_decl = try decls_anon_decl.finish( |
| 17855 | | array_decl_ty, |
| 17856 | | (try mod.intern(.{ .aggregate = .{ |
| 17857 | | .ty = array_decl_ty.toIntern(), |
| 17858 | | .storage = .{ .elems = decl_vals.items }, |
| 17859 | | } })).toValue(), |
| 17860 | | .none, // default alignment |
| 17861 | | ); |
| 17820 | const new_decl_val = try mod.intern(.{ .aggregate = .{ |
| 17821 | .ty = array_decl_ty.toIntern(), |
| 17822 | .storage = .{ .elems = decl_vals.items }, |
| 17823 | } }); |
| 17824 | const ptr_ty = (try sema.ptrType(.{ |
| 17825 | .child = declaration_ty.toIntern(), |
| 17826 | .flags = .{ |
| 17827 | .size = .Slice, |
| 17828 | .is_const = true, |
| 17829 | }, |
| 17830 | })).toIntern(); |
| 17862 | 17831 | return try mod.intern(.{ .ptr = .{ |
| 17863 | | .ty = (try sema.ptrType(.{ |
| 17864 | | .child = declaration_ty.toIntern(), |
| 17865 | | .flags = .{ |
| 17866 | | .size = .Slice, |
| 17867 | | .is_const = true, |
| 17868 | | }, |
| 17869 | | })).toIntern(), |
| 17870 | | .addr = .{ .decl = new_decl }, |
| 17832 | .ty = ptr_ty, |
| 17833 | .addr = .{ .anon_decl = .{ |
| 17834 | .orig_ty = ptr_ty, |
| 17835 | .val = new_decl_val, |
| 17836 | } }, |
| 17871 | 17837 | .len = (try mod.intValue(Type.usize, decl_vals.items.len)).toIntern(), |
| 17872 | 17838 | } }); |
| 17873 | 17839 | } |
| ... | ... | @@ -17896,25 +17862,22 @@ fn typeInfoNamespaceDecls( |
| 17896 | 17862 | } |
| 17897 | 17863 | if (decl.kind != .named or !decl.is_pub) continue; |
| 17898 | 17864 | const name_val = v: { |
| 17899 | | var anon_decl = try block.startAnonDecl(); |
| 17900 | | defer anon_decl.deinit(); |
| 17901 | 17865 | // TODO: write something like getCoercedInts to avoid needing to dupe |
| 17902 | 17866 | const name = try sema.arena.dupe(u8, ip.stringToSlice(decl.name)); |
| 17903 | 17867 | const new_decl_ty = try mod.arrayType(.{ |
| 17904 | 17868 | .len = name.len, |
| 17905 | 17869 | .child = .u8_type, |
| 17906 | 17870 | }); |
| 17907 | | const new_decl = try anon_decl.finish( |
| 17908 | | new_decl_ty, |
| 17909 | | (try mod.intern(.{ .aggregate = .{ |
| 17910 | | .ty = new_decl_ty.toIntern(), |
| 17911 | | .storage = .{ .bytes = name }, |
| 17912 | | } })).toValue(), |
| 17913 | | .none, // default alignment |
| 17914 | | ); |
| 17871 | const new_decl_val = try mod.intern(.{ .aggregate = .{ |
| 17872 | .ty = new_decl_ty.toIntern(), |
| 17873 | .storage = .{ .bytes = name }, |
| 17874 | } }); |
| 17915 | 17875 | break :v try mod.intern(.{ .ptr = .{ |
| 17916 | 17876 | .ty = .slice_const_u8_type, |
| 17917 | | .addr = .{ .decl = new_decl }, |
| 17877 | .addr = .{ .anon_decl = .{ |
| 17878 | .orig_ty = .slice_const_u8_type, |
| 17879 | .val = new_decl_val, |
| 17880 | } }, |
| 17918 | 17881 | .len = (try mod.intValue(Type.usize, name.len)).toIntern(), |
| 17919 | 17882 | } }); |
| 17920 | 17883 | }; |