aboutsummaryrefslogtreecommitdiff
path: root/src/check_decl.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-03-04 16:45:30 +0000
committergingerBill <bill@gingerbill.org>2021-03-04 16:45:30 +0000
commit15dbc99cb975675b89f5efe714d5209bce972014 (patch)
treef4afc5894fa21b2e42609bf1555ee57a177f8a1f /src/check_decl.cpp
parent17eb0ce525ffe94f13aabbc8d2245a9fda61aba0 (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/check_decl.cpp')
-rw-r--r--src/check_decl.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp
index 4a91f6742..95a3cb25a 100644
--- a/src/check_decl.cpp
+++ b/src/check_decl.cpp
@@ -799,14 +799,14 @@ void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) {
if (!are_signatures_similar_enough(this_type, other_type)) {
error(d->proc_lit,
"Redeclaration of foreign procedure '%.*s' with different type signatures\n"
- "\tat %.*s(%td:%td)",
- LIT(name), LIT(pos.file), pos.line, pos.column);
+ "\tat %s",
+ LIT(name), token_pos_to_string(pos));
}
} else if (!are_types_identical(this_type, other_type)) {
error(d->proc_lit,
"Foreign entity '%.*s' previously declared elsewhere with a different type\n"
- "\tat %.*s(%td:%td)",
- LIT(name), LIT(pos.file), pos.line, pos.column);
+ "\tat %s",
+ LIT(name), token_pos_to_string(pos));
}
} else if (name == "main") {
error(d->proc_lit, "The link name 'main' is reserved for internal use");
@@ -828,8 +828,8 @@ void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) {
// TODO(bill): Better error message?
error(d->proc_lit,
"Non unique linking name for procedure '%.*s'\n"
- "\tother at %.*s(%td:%td)",
- LIT(name), LIT(pos.file), pos.line, pos.column);
+ "\tother at %s",
+ LIT(name), token_pos_to_string(pos));
} else if (name == "main") {
error(d->proc_lit, "The link name 'main' is reserved for internal use");
} else {
@@ -919,8 +919,8 @@ void check_global_variable_decl(CheckerContext *ctx, Entity *e, Ast *type_expr,
if (!are_types_identical(this_type, other_type)) {
error(e->token,
"Foreign entity '%.*s' previously declared elsewhere with a different type\n"
- "\tat %.*s(%td:%td)",
- LIT(name), LIT(pos.file), pos.line, pos.column);
+ "\tat %s",
+ LIT(name), token_pos_to_string(pos));
}
} else {
string_map_set(fp, key, e);
@@ -1059,7 +1059,7 @@ void check_proc_group_decl(CheckerContext *ctx, Entity *pg_entity, DeclInfo *d)
}
if (is_invalid) {
- error_line("\tprevious procedure at %.*s(%td:%td)\n", LIT(pos.file), pos.line, pos.column);
+ error_line("\tprevious procedure at %s\n", token_pos_to_string(pos));
q->type = t_invalid;
}
}