@@ -27256,6 +27256,37 @@ fn fieldPtr(
27256
27256
if (ip.stringEqlSlice(field_name, "len")) {
27257
27257
const int_val = try mod.intValue(Type.usize, inner_ty.arrayLen(mod));
27258
27258
return anonDeclRef(sema, int_val.toIntern());
27259
+ } else if (ip.stringEqlSlice(field_name, "ptr") and is_pointer_to) {
27260
+ const ptr_info = object_ty.ptrInfo(mod);
27261
+ const new_ptr_ty = try sema.ptrType(.{
27262
+ .child = Type.fromInterned(ptr_info.child).childType(mod).toIntern(),
27263
+ .sentinel = if (object_ty.sentinel(mod)) |s| s.toIntern() else .none,
27264
+ .flags = .{
27265
+ .size = .Many,
27266
+ .alignment = ptr_info.flags.alignment,
27267
+ .is_const = ptr_info.flags.is_const,
27268
+ .is_volatile = ptr_info.flags.is_volatile,
27269
+ .is_allowzero = ptr_info.flags.is_allowzero,
27270
+ .address_space = ptr_info.flags.address_space,
27271
+ .vector_index = ptr_info.flags.vector_index,
27272
+ },
27273
+ .packed_offset = ptr_info.packed_offset,
27274
+ });
27275
+ const ptr_ptr_info = object_ptr_ty.ptrInfo(mod);
27276
+ const result_ty = try sema.ptrType(.{
27277
+ .child = new_ptr_ty.toIntern(),
27278
+ .sentinel = if (object_ptr_ty.sentinel(mod)) |s| s.toIntern() else .none,
27279
+ .flags = .{
27280
+ .alignment = ptr_ptr_info.flags.alignment,
27281
+ .is_const = ptr_ptr_info.flags.is_const,
27282
+ .is_volatile = ptr_ptr_info.flags.is_volatile,
27283
+ .is_allowzero = ptr_ptr_info.flags.is_allowzero,
27284
+ .address_space = ptr_ptr_info.flags.address_space,
27285
+ .vector_index = ptr_ptr_info.flags.vector_index,
27286
+ },
27287
+ .packed_offset = ptr_ptr_info.packed_offset,
27288
+ });
27289
+ return sema.bitCast(block, result_ty, object_ptr, src, null);
27259
27290
} else {
27260
27291
return sema.fail(
27261
27292
block,
0 commit comments