Rename to Type_Info_Parameters

This commit is contained in:
gingerBill
2023-02-08 11:23:21 +00:00
parent 2ff5d016d5
commit 6179d4feb1
9 changed files with 31 additions and 23 deletions
+4 -3
View File
@@ -25,7 +25,8 @@ Type_Info_Array :: runtime.Type_Info_Array
Type_Info_Enumerated_Array :: runtime.Type_Info_Enumerated_Array
Type_Info_Dynamic_Array :: runtime.Type_Info_Dynamic_Array
Type_Info_Slice :: runtime.Type_Info_Slice
Type_Info_Tuple :: runtime.Type_Info_Tuple
Type_Info_Parameters :: runtime.Type_Info_Parameters
Type_Info_Tuple :: runtime.Type_Info_Parameters
Type_Info_Struct :: runtime.Type_Info_Struct
Type_Info_Union :: runtime.Type_Info_Union
Type_Info_Enum :: runtime.Type_Info_Enum
@@ -96,7 +97,7 @@ type_kind :: proc(T: typeid) -> Type_Kind {
case Type_Info_Enumerated_Array: return .Enumerated_Array
case Type_Info_Dynamic_Array: return .Dynamic_Array
case Type_Info_Slice: return .Slice
case Type_Info_Tuple: return .Tuple
case Type_Info_Parameters: return .Tuple
case Type_Info_Struct: return .Struct
case Type_Info_Union: return .Union
case Type_Info_Enum: return .Enum
@@ -1438,7 +1439,7 @@ equal :: proc(a, b: any, including_indirect_array_recursion := false, recursion_
switch v in t.variant {
case Type_Info_Named:
unreachable()
case Type_Info_Tuple:
case Type_Info_Parameters:
unreachable()
case Type_Info_Any:
if !including_indirect_array_recursion {
+11 -5
View File
@@ -101,8 +101,8 @@ are_types_identical :: proc(a, b: ^Type_Info) -> bool {
y := b.variant.(Type_Info_Slice) or_return
return are_types_identical(x.elem, y.elem)
case Type_Info_Tuple:
y := b.variant.(Type_Info_Tuple) or_return
case Type_Info_Parameters:
y := b.variant.(Type_Info_Parameters) or_return
if len(x.types) != len(y.types) { return false }
for _, i in x.types {
xt, yt := x.types[i], y.types[i]
@@ -335,9 +335,15 @@ is_slice :: proc(info: ^Type_Info) -> bool {
return ok
}
@(require_results)
is_parameters :: proc(info: ^Type_Info) -> bool {
if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Parameters)
return ok
}
@(require_results, deprecated="prefer is_parameters")
is_tuple :: proc(info: ^Type_Info) -> bool {
if info == nil { return false }
_, ok := type_info_base(info).variant.(Type_Info_Tuple)
_, ok := type_info_base(info).variant.(Type_Info_Parameters)
return ok
}
@(require_results)
@@ -490,7 +496,7 @@ write_type_writer :: proc(w: io.Writer, ti: ^Type_Info, n_written: ^int = nil) -
if info.params == nil {
io.write_string(w, "()", &n) or_return
} else {
t := info.params.variant.(Type_Info_Tuple)
t := info.params.variant.(Type_Info_Parameters)
io.write_string(w, "(", &n) or_return
for t, i in t.types {
if i > 0 {
@@ -504,7 +510,7 @@ write_type_writer :: proc(w: io.Writer, ti: ^Type_Info, n_written: ^int = nil) -
io.write_string(w, " -> ", &n) or_return
write_type(w, info.results, &n) or_return
}
case Type_Info_Tuple:
case Type_Info_Parameters:
count := len(info.names)
if count != 1 {
io.write_string(w, "(", &n) or_return