mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-31 11:50:07 +00:00
Rename to Type_Info_Parameters
This commit is contained in:
@@ -198,7 +198,7 @@ marshal_to_writer :: proc(w: io.Writer, v: any, opt: ^Marshal_Options) -> (err:
|
||||
case runtime.Type_Info_Procedure:
|
||||
return .Unsupported_Type
|
||||
|
||||
case runtime.Type_Info_Tuple:
|
||||
case runtime.Type_Info_Parameters:
|
||||
return .Unsupported_Type
|
||||
|
||||
case runtime.Type_Info_Simd_Vector:
|
||||
|
||||
+2
-2
@@ -1783,8 +1783,8 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
|
||||
|
||||
type_info := type_info_of(v.id)
|
||||
switch info in type_info.variant {
|
||||
case runtime.Type_Info_Any: // Ignore
|
||||
case runtime.Type_Info_Tuple: // Ignore
|
||||
case runtime.Type_Info_Any: // Ignore
|
||||
case runtime.Type_Info_Parameters: // Ignore
|
||||
|
||||
case runtime.Type_Info_Named:
|
||||
fmt_named(fi, v, verb, info)
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
@@ -83,8 +83,8 @@ Type_Info_Multi_Pointer :: struct {
|
||||
elem: ^Type_Info,
|
||||
}
|
||||
Type_Info_Procedure :: struct {
|
||||
params: ^Type_Info, // Type_Info_Tuple
|
||||
results: ^Type_Info, // Type_Info_Tuple
|
||||
params: ^Type_Info, // Type_Info_Parameters
|
||||
results: ^Type_Info, // Type_Info_Parameters
|
||||
variadic: bool,
|
||||
convention: Calling_Convention,
|
||||
}
|
||||
@@ -104,10 +104,12 @@ Type_Info_Enumerated_Array :: struct {
|
||||
}
|
||||
Type_Info_Dynamic_Array :: struct {elem: ^Type_Info, elem_size: int}
|
||||
Type_Info_Slice :: struct {elem: ^Type_Info, elem_size: int}
|
||||
Type_Info_Tuple :: struct { // Only used for procedures parameters and results
|
||||
|
||||
Type_Info_Parameters :: struct { // Only used for procedures parameters and results
|
||||
types: []^Type_Info,
|
||||
names: []string,
|
||||
}
|
||||
Type_Info_Tuple :: Type_Info_Parameters // Will be removed eventually
|
||||
|
||||
Type_Info_Struct :: struct {
|
||||
types: []^Type_Info,
|
||||
@@ -208,7 +210,7 @@ Type_Info :: struct {
|
||||
Type_Info_Enumerated_Array,
|
||||
Type_Info_Dynamic_Array,
|
||||
Type_Info_Slice,
|
||||
Type_Info_Tuple,
|
||||
Type_Info_Parameters,
|
||||
Type_Info_Struct,
|
||||
Type_Info_Union,
|
||||
Type_Info_Enum,
|
||||
|
||||
@@ -303,7 +303,7 @@ print_type :: proc "contextless" (ti: ^Type_Info) {
|
||||
if info.params == nil {
|
||||
print_string("()")
|
||||
} else {
|
||||
t := info.params.variant.(Type_Info_Tuple)
|
||||
t := info.params.variant.(Type_Info_Parameters)
|
||||
print_byte('(')
|
||||
for t, i in t.types {
|
||||
if i > 0 { print_string(", ") }
|
||||
@@ -315,7 +315,7 @@ print_type :: proc "contextless" (ti: ^Type_Info) {
|
||||
print_string(" -> ")
|
||||
print_type(info.results)
|
||||
}
|
||||
case Type_Info_Tuple:
|
||||
case Type_Info_Parameters:
|
||||
count := len(info.names)
|
||||
if count != 1 { print_byte('(') }
|
||||
for name, i in info.names {
|
||||
|
||||
Reference in New Issue
Block a user