From 45af29da8095af16729955117a165d23e77cd740 Mon Sep 17 00:00:00 2001
From: reduz <reduzio@gmail.com>
Date: Thu, 19 May 2022 17:00:06 +0200
Subject: Add a new HashSet template

* Intended to replace RBSet in most cases.
* Optimized for iteration speed
---
 core/debugger/local_debugger.cpp  | 6 +++---
 core/debugger/script_debugger.cpp | 2 +-
 core/debugger/script_debugger.h   | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

(limited to 'core/debugger')

diff --git a/core/debugger/local_debugger.cpp b/core/debugger/local_debugger.cpp
index f378ba94c3..06e08081e9 100644
--- a/core/debugger/local_debugger.cpp
+++ b/core/debugger/local_debugger.cpp
@@ -241,15 +241,15 @@ void LocalDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
 
 		} else if (line.begins_with("br") || line.begins_with("break")) {
 			if (line.get_slice_count(" ") <= 1) {
-				const HashMap<int, RBSet<StringName>> &breakpoints = script_debugger->get_breakpoints();
+				const HashMap<int, HashSet<StringName>> &breakpoints = script_debugger->get_breakpoints();
 				if (breakpoints.size() == 0) {
 					print_line("No Breakpoints.");
 					continue;
 				}
 
 				print_line("Breakpoint(s): " + itos(breakpoints.size()));
-				for (const KeyValue<int, RBSet<StringName>> &E : breakpoints) {
-					print_line("\t" + String(E.value.front()->get()) + ":" + itos(E.key));
+				for (const KeyValue<int, HashSet<StringName>> &E : breakpoints) {
+					print_line("\t" + String(*E.value.begin()) + ":" + itos(E.key));
 				}
 
 			} else {
diff --git a/core/debugger/script_debugger.cpp b/core/debugger/script_debugger.cpp
index 1efa7f7690..e30f3e7886 100644
--- a/core/debugger/script_debugger.cpp
+++ b/core/debugger/script_debugger.cpp
@@ -50,7 +50,7 @@ int ScriptDebugger::get_depth() const {
 
 void ScriptDebugger::insert_breakpoint(int p_line, const StringName &p_source) {
 	if (!breakpoints.has(p_line)) {
-		breakpoints[p_line] = RBSet<StringName>();
+		breakpoints[p_line] = HashSet<StringName>();
 	}
 	breakpoints[p_line].insert(p_source);
 }
diff --git a/core/debugger/script_debugger.h b/core/debugger/script_debugger.h
index a5a72d7c54..5124b357a5 100644
--- a/core/debugger/script_debugger.h
+++ b/core/debugger/script_debugger.h
@@ -33,8 +33,8 @@
 
 #include "core/object/script_language.h"
 #include "core/string/string_name.h"
+#include "core/templates/hash_set.h"
 #include "core/templates/rb_map.h"
-#include "core/templates/rb_set.h"
 #include "core/templates/vector.h"
 
 class ScriptDebugger {
@@ -44,7 +44,7 @@ class ScriptDebugger {
 	int depth = -1;
 	bool skip_breakpoints = false;
 
-	HashMap<int, RBSet<StringName>> breakpoints;
+	HashMap<int, HashSet<StringName>> breakpoints;
 
 	ScriptLanguage *break_lang = nullptr;
 	Vector<StackInfo> error_stack_info;
@@ -66,7 +66,7 @@ public:
 	bool is_breakpoint(int p_line, const StringName &p_source) const;
 	bool is_breakpoint_line(int p_line) const;
 	void clear_breakpoints();
-	const HashMap<int, RBSet<StringName>> &get_breakpoints() const { return breakpoints; }
+	const HashMap<int, HashSet<StringName>> &get_breakpoints() const { return breakpoints; }
 
 	void debug(ScriptLanguage *p_lang, bool p_can_continue = true, bool p_is_error_breakpoint = false);
 	ScriptLanguage *get_break_language() const;
-- 
cgit v1.2.3