mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-30 19:30:06 +00:00
Add multi pointers to core
This commit is contained in:
@@ -74,6 +74,9 @@ Type_Info_Type_Id :: struct {};
|
||||
Type_Info_Pointer :: struct {
|
||||
elem: ^Type_Info, // nil -> rawptr
|
||||
};
|
||||
Type_Info_Multi_Pointer :: struct {
|
||||
elem: ^Type_Info,
|
||||
};
|
||||
Type_Info_Procedure :: struct {
|
||||
params: ^Type_Info, // Type_Info_Tuple
|
||||
results: ^Type_Info, // Type_Info_Tuple
|
||||
@@ -184,6 +187,7 @@ Type_Info :: struct {
|
||||
Type_Info_Any,
|
||||
Type_Info_Type_Id,
|
||||
Type_Info_Pointer,
|
||||
Type_Info_Multi_Pointer,
|
||||
Type_Info_Procedure,
|
||||
Type_Info_Array,
|
||||
Type_Info_Enumerated_Array,
|
||||
@@ -214,6 +218,7 @@ Typeid_Kind :: enum u8 {
|
||||
Any,
|
||||
Type_Id,
|
||||
Pointer,
|
||||
Multi_Pointer,
|
||||
Procedure,
|
||||
Array,
|
||||
Enumerated_Array,
|
||||
@@ -340,7 +345,7 @@ Context :: struct {
|
||||
|
||||
|
||||
Raw_String :: struct {
|
||||
data: ^byte,
|
||||
data: [^]byte,
|
||||
len: int,
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,24 @@ slice_handle_error :: proc "contextless" (file: string, line, column: i32, lo, h
|
||||
bounds_trap();
|
||||
}
|
||||
|
||||
multi_pointer_slice_handle_error :: proc "contextless" (file: string, line, column: i32, lo, hi: int) -> ! {
|
||||
print_caller_location(Source_Code_Location{file, line, column, ""});
|
||||
print_string(" Invalid slice indices: ");
|
||||
print_i64(i64(lo));
|
||||
print_string(":");
|
||||
print_i64(i64(hi));
|
||||
print_byte('\n');
|
||||
bounds_trap();
|
||||
}
|
||||
|
||||
|
||||
multi_pointer_slice_expr_error :: proc "contextless" (file: string, line, column: i32, lo, hi: int) {
|
||||
if lo <= hi {
|
||||
return;
|
||||
}
|
||||
multi_pointer_slice_handle_error(file, line, column, lo, hi);
|
||||
}
|
||||
|
||||
slice_expr_error_hi :: proc "contextless" (file: string, line, column: i32, hi: int, len: int) {
|
||||
if 0 <= hi && hi <= len {
|
||||
return;
|
||||
|
||||
@@ -203,6 +203,9 @@ print_type :: proc "contextless" (ti: ^Type_Info) {
|
||||
print_string("^");
|
||||
print_type(info.elem);
|
||||
}
|
||||
case Type_Info_Multi_Pointer:
|
||||
print_string("[^]");
|
||||
print_type(info.elem);
|
||||
case Type_Info_Procedure:
|
||||
print_string("proc");
|
||||
if info.params == nil {
|
||||
|
||||
Reference in New Issue
Block a user