diff options
| author | gingerBill <bill@gingerbill.org> | 2021-03-04 16:45:30 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-03-04 16:45:30 +0000 |
| commit | 15dbc99cb975675b89f5efe714d5209bce972014 (patch) | |
| tree | f4afc5894fa21b2e42609bf1555ee57a177f8a1f /src/query_data.cpp | |
| parent | 17eb0ce525ffe94f13aabbc8d2245a9fda61aba0 (diff) | |
Minimize TokenPos size by using `i32` for line/column/offset and file_id instead of `String`
To make `i32` safe, the parser limits the file size of odin files to a maximum of 2GiB (which will be good enough for the vast vast majority of cases)
Diffstat (limited to 'src/query_data.cpp')
| -rw-r--r-- | src/query_data.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/query_data.cpp b/src/query_data.cpp index 24cca6bbd..6c9637948 100644 --- a/src/query_data.cpp +++ b/src/query_data.cpp @@ -553,7 +553,7 @@ void generate_and_print_query_data_global_definitions(Checker *c, Timings *timin def->add("package", e->pkg->name); def->add("name", name); - def->add("filepath", e->token.pos.file); + def->add("filepath", get_file_path_string(e->token.pos.file_id)); def->add("line", cast(i64)e->token.pos.line); def->add("column", cast(i64)e->token.pos.column); def->add("file_offset", cast(i64)e->token.pos.offset); @@ -915,7 +915,7 @@ void generate_and_print_query_data_go_to_definitions(Checker *c) { } - AstFile **use_file_found = string_map_get(&c->info.files, pos.file); + AstFile **use_file_found = string_map_get(&c->info.files, get_file_path_string(pos.file_id)); GB_ASSERT(use_file_found != nullptr); AstFile *use_file = *use_file_found; GB_ASSERT(use_file != nullptr); @@ -1005,7 +1005,7 @@ void generate_and_print_query_data_go_to_definitions(Checker *c) { AstFile *def_file = e->file; if (def_file == nullptr) { - auto *def_file_found = string_map_get(&c->info.files, e->token.pos.file); + auto *def_file_found = string_map_get(&c->info.files, get_file_path_string(e->token.pos.file_id)); if (def_file_found == nullptr) { continue; } |