| ... | @@ -10269,11 +10269,41 @@ fn zirReify(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I | ... | @@ -10269,11 +10269,41 @@ fn zirReify(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I |
| 10269 | var buffer: Value.ToTypeBuffer = undefined; | 10269 | var buffer: Value.ToTypeBuffer = undefined; |
| 10270 | const child_ty = child_val.toType(&buffer); | 10270 | const child_ty = child_val.toType(&buffer); |
| 10271 | | 10271 | |
| 10272 | const ty = try Type.vector(sema.arena, len, child_ty); | 10272 | const ty = try Type.vector(sema.arena, len, try child_ty.copy(sema.arena)); |
| 10273 | return sema.addType(ty); | 10273 | return sema.addType(ty); |
| 10274 | }, | 10274 | }, |
| 10275 | .Float => return sema.fail(block, src, "TODO: Sema.zirReify for Float", .{}), | 10275 | .Float => return sema.fail(block, src, "TODO: Sema.zirReify for Float", .{}), |
| 10276 | .Pointer => return sema.fail(block, src, "TODO: Sema.zirReify for Pointer", .{}), | 10276 | .Pointer => { |
| | 10277 | const struct_val = union_val.val.castTag(.@"struct").?.data; |
| | 10278 | // TODO use reflection instead of magic numbers here |
| | 10279 | const size_val = struct_val[0]; |
| | 10280 | const is_const_val = struct_val[1]; |
| | 10281 | const is_volatile_val = struct_val[2]; |
| | 10282 | const alignment_val = struct_val[3]; |
| | 10283 | const address_space_val = struct_val[4]; |
| | 10284 | const child_val = struct_val[5]; |
| | 10285 | const is_allowzero_val = struct_val[6]; |
| | 10286 | const sentinel_val = struct_val[7]; |
| | 10287 | |
| | 10288 | var buffer: Value.ToTypeBuffer = undefined; |
| | 10289 | const child_ty = child_val.toType(&buffer); |
| | 10290 | |
| | 10291 | if (!sentinel_val.isNull()) { |
| | 10292 | return sema.fail(block, src, "TODO: implement zirReify for pointer with non-null sentinel", .{}); |
| | 10293 | } |
| | 10294 | |
| | 10295 | const ty = try Type.ptr(sema.arena, .{ |
| | 10296 | .size = size_val.toEnum(std.builtin.TypeInfo.Pointer.Size), |
| | 10297 | .mutable = !is_const_val.toBool(), |
| | 10298 | .@"volatile" = is_volatile_val.toBool(), |
| | 10299 | .@"align" = @intCast(u8, alignment_val.toUnsignedInt()), // TODO: Validate this value. |
| | 10300 | .@"addrspace" = address_space_val.toEnum(std.builtin.AddressSpace), |
| | 10301 | .pointee_type = try child_ty.copy(sema.arena), |
| | 10302 | .@"allowzero" = is_allowzero_val.toBool(), |
| | 10303 | .sentinel = null, |
| | 10304 | }); |
| | 10305 | return sema.addType(ty); |
| | 10306 | }, |
| 10277 | .Array => return sema.fail(block, src, "TODO: Sema.zirReify for Array", .{}), | 10307 | .Array => return sema.fail(block, src, "TODO: Sema.zirReify for Array", .{}), |
| 10278 | .Struct => return sema.fail(block, src, "TODO: Sema.zirReify for Struct", .{}), | 10308 | .Struct => return sema.fail(block, src, "TODO: Sema.zirReify for Struct", .{}), |
| 10279 | .Optional => return sema.fail(block, src, "TODO: Sema.zirReify for Optional", .{}), | 10309 | .Optional => return sema.fail(block, src, "TODO: Sema.zirReify for Optional", .{}), |