mirror of
https://github.com/ziglang/zig.git
synced 2025-12-24 15:13:08 +00:00
Type: update to use InternPool for some methods
This commit is contained in:
parent
ca3cf93b21
commit
fb16ad3add
40
src/type.zig
40
src/type.zig
@ -5921,32 +5921,44 @@ pub const Type = struct {
|
||||
};
|
||||
|
||||
pub fn isTuple(ty: Type) bool {
|
||||
return switch (ty.tag()) {
|
||||
.tuple, .empty_struct_literal => true,
|
||||
.@"struct" => ty.castTag(.@"struct").?.data.is_tuple,
|
||||
else => false,
|
||||
return switch (ty.ip_index) {
|
||||
.none => switch (ty.tag()) {
|
||||
.tuple, .empty_struct_literal => true,
|
||||
.@"struct" => ty.castTag(.@"struct").?.data.is_tuple,
|
||||
else => false,
|
||||
},
|
||||
else => false, // TODO
|
||||
};
|
||||
}
|
||||
|
||||
pub fn isAnonStruct(ty: Type) bool {
|
||||
return switch (ty.tag()) {
|
||||
.anon_struct, .empty_struct_literal => true,
|
||||
else => false,
|
||||
return switch (ty.ip_index) {
|
||||
.none => switch (ty.tag()) {
|
||||
.anon_struct, .empty_struct_literal => true,
|
||||
else => false,
|
||||
},
|
||||
else => false, // TODO
|
||||
};
|
||||
}
|
||||
|
||||
pub fn isTupleOrAnonStruct(ty: Type) bool {
|
||||
return switch (ty.tag()) {
|
||||
.tuple, .empty_struct_literal, .anon_struct => true,
|
||||
.@"struct" => ty.castTag(.@"struct").?.data.is_tuple,
|
||||
else => false,
|
||||
return switch (ty.ip_index) {
|
||||
.none => switch (ty.tag()) {
|
||||
.tuple, .empty_struct_literal, .anon_struct => true,
|
||||
.@"struct" => ty.castTag(.@"struct").?.data.is_tuple,
|
||||
else => false,
|
||||
},
|
||||
else => false, // TODO
|
||||
};
|
||||
}
|
||||
|
||||
pub fn isSimpleTuple(ty: Type) bool {
|
||||
return switch (ty.tag()) {
|
||||
.tuple, .empty_struct_literal => true,
|
||||
else => false,
|
||||
return switch (ty.ip_index) {
|
||||
.none => switch (ty.tag()) {
|
||||
.tuple, .empty_struct_literal => true,
|
||||
else => false,
|
||||
},
|
||||
else => false, // TODO
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user