aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-08-27 11:18:38 +0100
committergingerBill <bill@gingerbill.org>2021-08-27 11:18:38 +0100
commit582559f7ac54b62cbdccf6f396f072b15a950664 (patch)
tree987c4d69ebf5aa2e8d5be414f49666fbbfa42daa /src/check_expr.cpp
parent53556d9bd261272137256af9a5716dc26453337b (diff)
Correct did you mean logic and make thread-safe-er
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index f77f375b0..32bde44c8 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -3726,7 +3726,12 @@ 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));
+
DidYouMeanAnswers d = did_you_mean_make(heap_allocator(), fields.count, name);
defer (did_you_mean_destroy(&d));
@@ -3737,6 +3742,9 @@ 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));
+
DidYouMeanAnswers d = did_you_mean_make(heap_allocator(), scope->elements.entries.count, name);
defer (did_you_mean_destroy(&d));