mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-18 11:52:22 -07: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 {
|
||||
|
||||
+2
-2
@@ -2744,7 +2744,7 @@ gb_internal void init_core_type_info(Checker *c) {
|
||||
t_type_info_enumerated_array = find_core_type(c, str_lit("Type_Info_Enumerated_Array"));
|
||||
t_type_info_dynamic_array = find_core_type(c, str_lit("Type_Info_Dynamic_Array"));
|
||||
t_type_info_slice = find_core_type(c, str_lit("Type_Info_Slice"));
|
||||
t_type_info_tuple = find_core_type(c, str_lit("Type_Info_Tuple"));
|
||||
t_type_info_parameters = find_core_type(c, str_lit("Type_Info_Parameters"));
|
||||
t_type_info_struct = find_core_type(c, str_lit("Type_Info_Struct"));
|
||||
t_type_info_union = find_core_type(c, str_lit("Type_Info_Union"));
|
||||
t_type_info_enum = find_core_type(c, str_lit("Type_Info_Enum"));
|
||||
@@ -2773,7 +2773,7 @@ gb_internal void init_core_type_info(Checker *c) {
|
||||
t_type_info_enumerated_array_ptr = alloc_type_pointer(t_type_info_enumerated_array);
|
||||
t_type_info_dynamic_array_ptr = alloc_type_pointer(t_type_info_dynamic_array);
|
||||
t_type_info_slice_ptr = alloc_type_pointer(t_type_info_slice);
|
||||
t_type_info_tuple_ptr = alloc_type_pointer(t_type_info_tuple);
|
||||
t_type_info_parameters_ptr = alloc_type_pointer(t_type_info_parameters);
|
||||
t_type_info_struct_ptr = alloc_type_pointer(t_type_info_struct);
|
||||
t_type_info_union_ptr = alloc_type_pointer(t_type_info_union);
|
||||
t_type_info_enum_ptr = alloc_type_pointer(t_type_info_enum);
|
||||
|
||||
@@ -541,8 +541,7 @@ gb_internal void lb_setup_type_info_data(lbProcedure *p) { // NOTE(bill): Setup
|
||||
break;
|
||||
}
|
||||
case Type_Tuple: {
|
||||
tag = lb_const_ptr_cast(m, variant_ptr, t_type_info_tuple_ptr);
|
||||
|
||||
tag = lb_const_ptr_cast(m, variant_ptr, t_type_info_parameters_ptr);
|
||||
|
||||
lbValue memory_types = lb_type_info_member_types_offset(p, t->Tuple.variables.count);
|
||||
lbValue memory_names = lb_type_info_member_names_offset(p, t->Tuple.variables.count);
|
||||
|
||||
+2
-2
@@ -624,7 +624,7 @@ gb_global Type *t_type_info_array = nullptr;
|
||||
gb_global Type *t_type_info_enumerated_array = nullptr;
|
||||
gb_global Type *t_type_info_dynamic_array = nullptr;
|
||||
gb_global Type *t_type_info_slice = nullptr;
|
||||
gb_global Type *t_type_info_tuple = nullptr;
|
||||
gb_global Type *t_type_info_parameters = nullptr;
|
||||
gb_global Type *t_type_info_struct = nullptr;
|
||||
gb_global Type *t_type_info_union = nullptr;
|
||||
gb_global Type *t_type_info_enum = nullptr;
|
||||
@@ -653,7 +653,7 @@ gb_global Type *t_type_info_array_ptr = nullptr;
|
||||
gb_global Type *t_type_info_enumerated_array_ptr = nullptr;
|
||||
gb_global Type *t_type_info_dynamic_array_ptr = nullptr;
|
||||
gb_global Type *t_type_info_slice_ptr = nullptr;
|
||||
gb_global Type *t_type_info_tuple_ptr = nullptr;
|
||||
gb_global Type *t_type_info_parameters_ptr = nullptr;
|
||||
gb_global Type *t_type_info_struct_ptr = nullptr;
|
||||
gb_global Type *t_type_info_union_ptr = nullptr;
|
||||
gb_global Type *t_type_info_enum_ptr = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user