mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-09 13:01:38 -07:00
ERROR_BLOCK() any usages of "Did you mean?" like behaviour whilst iterating across a scope entry map
This commit is contained in:
+4
-6
@@ -3726,11 +3726,8 @@ void check_did_you_mean_print(DidYouMeanAnswers *d) {
|
||||
}
|
||||
}
|
||||
|
||||
gb_global BlockingMutex did_you_mean_mutex;
|
||||
|
||||
void check_did_you_mean_type(String const &name, Array<Entity *> const &fields) {
|
||||
mutex_lock(&did_you_mean_mutex);
|
||||
defer (mutex_unlock(&did_you_mean_mutex));
|
||||
ERROR_BLOCK();
|
||||
|
||||
DidYouMeanAnswers d = did_you_mean_make(heap_allocator(), fields.count, name);
|
||||
defer (did_you_mean_destroy(&d));
|
||||
@@ -3742,8 +3739,7 @@ void check_did_you_mean_type(String const &name, Array<Entity *> const &fields)
|
||||
}
|
||||
|
||||
void check_did_you_mean_scope(String const &name, Scope *scope) {
|
||||
mutex_lock(&did_you_mean_mutex);
|
||||
defer (mutex_unlock(&did_you_mean_mutex));
|
||||
ERROR_BLOCK();
|
||||
|
||||
DidYouMeanAnswers d = did_you_mean_make(heap_allocator(), scope->elements.entries.count, name);
|
||||
defer (did_you_mean_destroy(&d));
|
||||
@@ -4977,6 +4973,8 @@ bool evaluate_where_clauses(CheckerContext *ctx, Ast *call_expr, Scope *scope, S
|
||||
return false;
|
||||
} else if (!o.value.value_bool) {
|
||||
if (print_err) {
|
||||
ERROR_BLOCK();
|
||||
|
||||
gbString str = expr_to_string(clause);
|
||||
error(clause, "'where' clause evaluated to false:\n\t%s", str);
|
||||
gb_string_free(str);
|
||||
|
||||
@@ -578,6 +578,8 @@ bool check_using_stmt_entity(CheckerContext *ctx, AstUsingStmt *us, Ast *expr, b
|
||||
}
|
||||
|
||||
add_entity_use(ctx, expr, e);
|
||||
|
||||
ERROR_BLOCK();
|
||||
|
||||
switch (e->kind) {
|
||||
case Entity_TypeName: {
|
||||
@@ -2336,6 +2338,8 @@ void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags) {
|
||||
if (is_blank_ident(name)) {
|
||||
error(token, "'using' cannot be applied variable declared as '_'");
|
||||
} else if (is_type_struct(t) || is_type_raw_union(t)) {
|
||||
ERROR_BLOCK();
|
||||
|
||||
Scope *scope = scope_of_node(t->Struct.node);
|
||||
for_array(i, scope->elements.entries) {
|
||||
Entity *f = scope->elements.entries[i].value;
|
||||
|
||||
@@ -2019,7 +2019,6 @@ int main(int arg_count, char const **arg_ptr) {
|
||||
virtual_memory_init();
|
||||
mutex_init(&fullpath_mutex);
|
||||
mutex_init(&hash_exact_value_mutex);
|
||||
mutex_init(&did_you_mean_mutex);
|
||||
|
||||
init_string_buffer_memory();
|
||||
init_string_interner();
|
||||
|
||||
@@ -377,6 +377,8 @@ void end_error_block(void) {
|
||||
mutex_unlock(&global_error_collector.block_mutex);
|
||||
}
|
||||
|
||||
#define ERROR_BLOCK() begin_error_block(); defer (end_error_block())
|
||||
|
||||
|
||||
#define ERROR_OUT_PROC(name) void name(char const *fmt, va_list va)
|
||||
typedef ERROR_OUT_PROC(ErrorOutProc);
|
||||
|
||||
Reference in New Issue
Block a user