mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
remove the kludges from std.builtin
I added these in an earlier commit in this branch. This commit removes them before the branch is merged.
This commit is contained in:
parent
484c3e8cbc
commit
1b64eed107
2 changed files with 48 additions and 10 deletions
|
|
@ -223,13 +223,6 @@ pub const SourceLocation = struct {
|
||||||
pub const TypeId = std.meta.Tag(Type);
|
pub const TypeId = std.meta.Tag(Type);
|
||||||
pub const TypeInfo = @compileError("deprecated; use Type");
|
pub const TypeInfo = @compileError("deprecated; use Type");
|
||||||
|
|
||||||
/// TODO this is a temporary alias because I don't see any handy methods in
|
|
||||||
/// Sema for accessing inner declarations.
|
|
||||||
pub const PtrSize = Type.Pointer.Size;
|
|
||||||
/// TODO this is a temporary alias because I don't see any handy methods in
|
|
||||||
/// Sema for accessing inner declarations.
|
|
||||||
pub const TmpContainerLayoutAlias = Type.ContainerLayout;
|
|
||||||
|
|
||||||
/// This data structure is used by the Zig language code generation and
|
/// This data structure is used by the Zig language code generation and
|
||||||
/// therefore must be kept in sync with the compiler implementation.
|
/// therefore must be kept in sync with the compiler implementation.
|
||||||
pub const Type = union(enum) {
|
pub const Type = union(enum) {
|
||||||
|
|
|
||||||
51
src/Sema.zig
51
src/Sema.zig
|
|
@ -16116,7 +16116,30 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
|
||||||
try info.pointee_type.lazyAbiAlignment(mod, sema.arena);
|
try info.pointee_type.lazyAbiAlignment(mod, sema.arena);
|
||||||
|
|
||||||
const addrspace_ty = try sema.getBuiltinType("AddressSpace");
|
const addrspace_ty = try sema.getBuiltinType("AddressSpace");
|
||||||
const ptr_size_ty = try sema.getBuiltinType("PtrSize");
|
const pointer_ty = t: {
|
||||||
|
const decl_index = (try sema.namespaceLookup(
|
||||||
|
block,
|
||||||
|
src,
|
||||||
|
(try sema.getBuiltinType("Type")).getNamespaceIndex(mod).unwrap().?,
|
||||||
|
"Pointer",
|
||||||
|
)).?;
|
||||||
|
try mod.declareDeclDependency(sema.owner_decl_index, decl_index);
|
||||||
|
try sema.ensureDeclAnalyzed(decl_index);
|
||||||
|
const decl = mod.declPtr(decl_index);
|
||||||
|
break :t decl.val.toType();
|
||||||
|
};
|
||||||
|
const ptr_size_ty = t: {
|
||||||
|
const decl_index = (try sema.namespaceLookup(
|
||||||
|
block,
|
||||||
|
src,
|
||||||
|
pointer_ty.getNamespaceIndex(mod).unwrap().?,
|
||||||
|
"Size",
|
||||||
|
)).?;
|
||||||
|
try mod.declareDeclDependency(sema.owner_decl_index, decl_index);
|
||||||
|
try sema.ensureDeclAnalyzed(decl_index);
|
||||||
|
const decl = mod.declPtr(decl_index);
|
||||||
|
break :t decl.val.toType();
|
||||||
|
};
|
||||||
|
|
||||||
const field_values = try sema.arena.create([8]Value);
|
const field_values = try sema.arena.create([8]Value);
|
||||||
field_values.* = .{
|
field_values.* = .{
|
||||||
|
|
@ -16469,7 +16492,18 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
|
||||||
break :v try Value.Tag.opt_payload.create(sema.arena, ty_val);
|
break :v try Value.Tag.opt_payload.create(sema.arena, ty_val);
|
||||||
} else Value.null;
|
} else Value.null;
|
||||||
|
|
||||||
const container_layout_ty = try sema.getBuiltinType("TmpContainerLayoutAlias");
|
const container_layout_ty = t: {
|
||||||
|
const decl_index = (try sema.namespaceLookup(
|
||||||
|
block,
|
||||||
|
src,
|
||||||
|
(try sema.getBuiltinType("Type")).getNamespaceIndex(mod).unwrap().?,
|
||||||
|
"ContainerLayout",
|
||||||
|
)).?;
|
||||||
|
try mod.declareDeclDependency(sema.owner_decl_index, decl_index);
|
||||||
|
try sema.ensureDeclAnalyzed(decl_index);
|
||||||
|
const decl = mod.declPtr(decl_index);
|
||||||
|
break :t decl.val.toType();
|
||||||
|
};
|
||||||
|
|
||||||
const field_values = try sema.arena.create([4]Value);
|
const field_values = try sema.arena.create([4]Value);
|
||||||
field_values.* = .{
|
field_values.* = .{
|
||||||
|
|
@ -16648,7 +16682,18 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const container_layout_ty = try sema.getBuiltinType("TmpContainerLayoutAlias");
|
const container_layout_ty = t: {
|
||||||
|
const decl_index = (try sema.namespaceLookup(
|
||||||
|
block,
|
||||||
|
src,
|
||||||
|
(try sema.getBuiltinType("Type")).getNamespaceIndex(mod).unwrap().?,
|
||||||
|
"ContainerLayout",
|
||||||
|
)).?;
|
||||||
|
try mod.declareDeclDependency(sema.owner_decl_index, decl_index);
|
||||||
|
try sema.ensureDeclAnalyzed(decl_index);
|
||||||
|
const decl = mod.declPtr(decl_index);
|
||||||
|
break :t decl.val.toType();
|
||||||
|
};
|
||||||
|
|
||||||
const field_values = try sema.arena.create([5]Value);
|
const field_values = try sema.arena.create([5]Value);
|
||||||
field_values.* = .{
|
field_values.* = .{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue