aboutsummaryrefslogtreecommitdiff
path: root/src/checker.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-05-25 20:24:19 +0100
committergingerBill <bill@gingerbill.org>2019-05-25 20:24:19 +0100
commit458ec5922e69f105ca92d348e475693dfa252ad0 (patch)
tree0c7db7614a6a3f9d05816e54adc03d82118f06c3 /src/checker.cpp
parentf5fdd031f9b763a2b6a86f2fc536735fc8d7ed5d (diff)
odin query
Output .json file containing information about the program
Diffstat (limited to 'src/checker.cpp')
-rw-r--r--src/checker.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/checker.cpp b/src/checker.cpp
index 693ed98c5..5c18e09e9 100644
--- a/src/checker.cpp
+++ b/src/checker.cpp
@@ -826,13 +826,14 @@ void destroy_checker_context(CheckerContext *ctx) {
destroy_checker_poly_path(ctx->poly_path);
}
-void init_checker(Checker *c, Parser *parser) {
+bool init_checker(Checker *c, Parser *parser) {
+ c->parser = parser;
+
if (global_error_collector.count > 0) {
- gb_exit(1);
+ return false;
}
gbAllocator a = heap_allocator();
- c->parser = parser;
init_checker_info(&c->info);
array_init(&c->procs_to_check, a);
@@ -846,6 +847,7 @@ void init_checker(Checker *c, Parser *parser) {
c->allocator = heap_allocator();
c->init_ctx = make_checker_context(c);
+ return true;
}
void destroy_checker(Checker *c) {
@@ -2189,7 +2191,11 @@ DECL_ATTRIBUTE_PROC(var_decl_attribute) {
model == "localexec") {
ac->thread_local_model = model;
} else {
- error(elem, "Invalid thread local model '%.*s'", LIT(model));
+ error(elem, "Invalid thread local model '%.*s'. Valid models:", LIT(model));
+ error_line("\tdefault\n");
+ error_line("\tlocaldynamic\n");
+ error_line("\tinitialexec\n");
+ error_line("\tlocalexec\n");
}
} else {
error(elem, "Expected either no value or a string for '%.*s'", LIT(name));
@@ -2597,10 +2603,13 @@ void check_collect_value_decl(CheckerContext *c, Ast *decl) {
if (e->kind != Entity_Procedure) {
if (fl != nullptr) {
+ begin_error_block();
+ defer (end_error_block());
+
AstKind kind = init->kind;
error(name, "Only procedures and variables are allowed to be in a foreign block, got %.*s", LIT(ast_strings[kind]));
if (kind == Ast_ProcType) {
- gb_printf_err("\tDid you forget to append '---' to the procedure?\n");
+ error_line("\tDid you forget to append '---' to the procedure?\n");
}
}
}