diff options
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/editor/gdscript_translation_parser_plugin.h | 8 | ||||
-rw-r--r-- | modules/gdscript/gdscript.cpp | 20 | ||||
-rw-r--r-- | modules/gdscript/gdscript.h | 13 | ||||
-rw-r--r-- | modules/gdscript/gdscript_analyzer.cpp | 6 | ||||
-rw-r--r-- | modules/gdscript/gdscript_analyzer.h | 2 | ||||
-rw-r--r-- | modules/gdscript/gdscript_cache.cpp | 6 | ||||
-rw-r--r-- | modules/gdscript/gdscript_cache.h | 4 | ||||
-rw-r--r-- | modules/gdscript/gdscript_compiler.h | 6 | ||||
-rw-r--r-- | modules/gdscript/gdscript_editor.cpp | 4 | ||||
-rw-r--r-- | modules/gdscript/gdscript_parser.h | 8 | ||||
-rw-r--r-- | modules/gdscript/gdscript_tokenizer.h | 2 | ||||
-rw-r--r-- | modules/gdscript/language_server/gdscript_workspace.cpp | 6 | ||||
-rw-r--r-- | modules/gdscript/register_types.cpp | 2 |
13 files changed, 44 insertions, 43 deletions
diff --git a/modules/gdscript/editor/gdscript_translation_parser_plugin.h b/modules/gdscript/editor/gdscript_translation_parser_plugin.h index 4633a431d8..969a50f48c 100644 --- a/modules/gdscript/editor/gdscript_translation_parser_plugin.h +++ b/modules/gdscript/editor/gdscript_translation_parser_plugin.h @@ -31,7 +31,7 @@ #ifndef GDSCRIPT_TRANSLATION_PARSER_PLUGIN_H #define GDSCRIPT_TRANSLATION_PARSER_PLUGIN_H -#include "core/templates/rb_set.h" +#include "core/templates/hash_set.h" #include "editor/editor_translation_parser.h" #include "modules/gdscript/gdscript_parser.h" @@ -44,9 +44,9 @@ class GDScriptEditorTranslationParserPlugin : public EditorTranslationParserPlug // List of patterns used for extracting translation strings. StringName tr_func = "tr"; StringName trn_func = "tr_n"; - RBSet<StringName> assignment_patterns; - RBSet<StringName> first_arg_patterns; - RBSet<StringName> second_arg_patterns; + HashSet<StringName> assignment_patterns; + HashSet<StringName> first_arg_patterns; + HashSet<StringName> second_arg_patterns; // FileDialog patterns. StringName fd_add_filter = "add_filter"; StringName fd_set_filter = "set_filters"; diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index e400d0bf94..066b772227 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -764,8 +764,8 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc _update_exports_values(values, propnames); if (changed) { - for (RBSet<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) { - E->get()->update(propnames, values); + for (PlaceHolderScriptInstance *E : placeholders) { + E->update(propnames, values); } } else { p_instance_to_update->update(propnames, values); @@ -788,10 +788,10 @@ void GDScript::update_exports() { return; } - RBSet<ObjectID> copy = inheriters_cache; //might get modified + HashSet<ObjectID> copy = inheriters_cache; //might get modified - for (RBSet<ObjectID>::Element *E = copy.front(); E; E = E->next()) { - Object *id = ObjectDB::get_instance(E->get()); + for (const ObjectID &E : copy) { + Object *id = ObjectDB::get_instance(E); GDScript *s = Object::cast_to<GDScript>(id); if (!s) { continue; @@ -937,10 +937,10 @@ void GDScript::get_constants(HashMap<StringName, Variant> *p_constants) { } } -void GDScript::get_members(RBSet<StringName> *p_members) { +void GDScript::get_members(HashSet<StringName> *p_members) { if (p_members) { - for (RBSet<StringName>::Element *E = members.front(); E; E = E->next()) { - p_members->insert(E->get()); + for (const StringName &E : members) { + p_members->insert(E); } } } @@ -1916,7 +1916,7 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_so #ifdef TOOLS_ENABLED while (script->placeholders.size()) { - Object *obj = script->placeholders.front()->get()->get_owner(); + Object *obj = (*script->placeholders.begin())->get_owner(); //save instance info if (obj->get_script_instance()) { @@ -1926,7 +1926,7 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_so obj->set_script(Variant()); } else { // no instance found. Let's remove it so we don't loop forever - script->placeholders.erase(script->placeholders.front()->get()); + script->placeholders.erase(*script->placeholders.begin()); } } diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index 5199d3215d..80f187a375 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -37,6 +37,7 @@ #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" #include "core/object/script_language.h" +#include "core/templates/rb_set.h" #include "gdscript_function.h" class GDScriptNativeClass : public RefCounted { @@ -80,7 +81,7 @@ class GDScript : public Script { GDScript *_base = nullptr; //fast pointer access GDScript *_owner = nullptr; //for subclasses - RBSet<StringName> members; //members are just indices to the instantiated script. + HashSet<StringName> members; //members are just indices to the instantiated script. HashMap<StringName, Variant> constants; HashMap<StringName, GDScriptFunction *> member_functions; HashMap<StringName, MemberInfo> member_indices; //members are just indices to the instantiated script. @@ -95,7 +96,7 @@ class GDScript : public Script { List<PropertyInfo> members_cache; HashMap<StringName, Variant> member_default_values_cache; Ref<GDScript> base_cache; - RBSet<ObjectID> inheriters_cache; + HashSet<ObjectID> inheriters_cache; bool source_changed_cache = false; bool placeholder_fallback_enabled = false; void _update_exports_values(HashMap<StringName, Variant> &values, List<PropertyInfo> &propnames); @@ -139,7 +140,7 @@ class GDScript : public Script { String _get_debug_path() const; #ifdef TOOLS_ENABLED - RBSet<PlaceHolderScriptInstance *> placeholders; + HashSet<PlaceHolderScriptInstance *> placeholders; //void _update_placeholder(PlaceHolderScriptInstance *p_placeholder); virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder) override; #endif @@ -178,7 +179,7 @@ public: const HashMap<StringName, Ref<GDScript>> &get_subclasses() const { return subclasses; } const HashMap<StringName, Variant> &get_constants() const { return constants; } - const RBSet<StringName> &get_members() const { return members; } + const HashSet<StringName> &get_members() const { return members; } const GDScriptDataType &get_member_type(const StringName &p_member) const { CRASH_COND(!member_indices.has(p_member)); return member_indices[p_member].data_type; @@ -246,7 +247,7 @@ public: } virtual void get_constants(HashMap<StringName, Variant> *p_constants) override; - virtual void get_members(RBSet<StringName> *p_members) override; + virtual void get_members(HashSet<StringName> *p_members) override; virtual const Vector<Multiplayer::RPCConfig> get_rpc_methods() const override; @@ -449,7 +450,7 @@ public: virtual bool is_using_templates() override; virtual Ref<Script> make_template(const String &p_template, const String &p_class_name, const String &p_base_class_name) const override; virtual Vector<ScriptTemplate> get_built_in_templates(StringName p_object) override; - virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptLanguage::ScriptError> *r_errors = nullptr, List<ScriptLanguage::Warning> *r_warnings = nullptr, RBSet<int> *r_safe_lines = nullptr) const override; + virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptLanguage::ScriptError> *r_errors = nullptr, List<ScriptLanguage::Warning> *r_warnings = nullptr, HashSet<int> *r_safe_lines = nullptr) const override; virtual Script *create_script() const override; virtual bool has_named_classes() const override; virtual bool supports_builtin_mode() const override; diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 32fa3b8c87..3976bde8c9 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -898,7 +898,7 @@ void GDScriptAnalyzer::resolve_class_body(GDScriptParser::ClassNode *p_class) { } #ifdef DEBUG_ENABLED - RBSet<uint32_t> previously_ignored = parser->ignored_warning_codes; + HashSet<uint32_t> previously_ignored = parser->ignored_warning_codes; for (uint32_t ignored_warning : member.function->ignored_warnings) { parser->ignored_warning_codes.insert(ignored_warning); } @@ -947,7 +947,7 @@ void GDScriptAnalyzer::resolve_class_body(GDScriptParser::ClassNode *p_class) { GDScriptParser::ClassNode::Member member = p_class->members[i]; if (member.type == GDScriptParser::ClassNode::Member::VARIABLE) { #ifdef DEBUG_ENABLED - RBSet<uint32_t> previously_ignored = parser->ignored_warning_codes; + HashSet<uint32_t> previously_ignored = parser->ignored_warning_codes; for (uint32_t ignored_warning : member.function->ignored_warnings) { parser->ignored_warning_codes.insert(ignored_warning); } @@ -1279,7 +1279,7 @@ void GDScriptAnalyzer::resolve_suite(GDScriptParser::SuiteNode *p_suite) { } #ifdef DEBUG_ENABLED - RBSet<uint32_t> previously_ignored = parser->ignored_warning_codes; + HashSet<uint32_t> previously_ignored = parser->ignored_warning_codes; for (uint32_t ignored_warning : stmt->ignored_warnings) { parser->ignored_warning_codes.insert(ignored_warning); } diff --git a/modules/gdscript/gdscript_analyzer.h b/modules/gdscript/gdscript_analyzer.h index 5b03f6dbb4..3966b81b6e 100644 --- a/modules/gdscript/gdscript_analyzer.h +++ b/modules/gdscript/gdscript_analyzer.h @@ -33,7 +33,7 @@ #include "core/object/object.h" #include "core/object/ref_counted.h" -#include "core/templates/rb_set.h" +#include "core/templates/hash_set.h" #include "gdscript_cache.h" #include "gdscript_parser.h" diff --git a/modules/gdscript/gdscript_cache.cpp b/modules/gdscript/gdscript_cache.cpp index bd98d66fcc..4c15fca91e 100644 --- a/modules/gdscript/gdscript_cache.cpp +++ b/modules/gdscript/gdscript_cache.cpp @@ -223,13 +223,13 @@ Error GDScriptCache::finish_compiling(const String &p_owner) { singleton->full_gdscript_cache[p_owner] = script.ptr(); singleton->shallow_gdscript_cache.erase(p_owner); - RBSet<String> depends = singleton->dependencies[p_owner]; + HashSet<String> depends = singleton->dependencies[p_owner]; Error err = OK; - for (const RBSet<String>::Element *E = depends.front(); E != nullptr; E = E->next()) { + for (const String &E : depends) { Error this_err = OK; // No need to save the script. We assume it's already referenced in the owner. - get_full_script(E->get(), this_err); + get_full_script(E, this_err); if (this_err != OK) { err = this_err; diff --git a/modules/gdscript/gdscript_cache.h b/modules/gdscript/gdscript_cache.h index 8abae7d4ad..b971bdd984 100644 --- a/modules/gdscript/gdscript_cache.h +++ b/modules/gdscript/gdscript_cache.h @@ -34,7 +34,7 @@ #include "core/object/ref_counted.h" #include "core/os/mutex.h" #include "core/templates/hash_map.h" -#include "core/templates/rb_set.h" +#include "core/templates/hash_set.h" #include "gdscript.h" class GDScriptAnalyzer; @@ -74,7 +74,7 @@ class GDScriptCache { HashMap<String, GDScriptParserRef *> parser_map; HashMap<String, GDScript *> shallow_gdscript_cache; HashMap<String, GDScript *> full_gdscript_cache; - HashMap<String, RBSet<String>> dependencies; + HashMap<String, HashSet<String>> dependencies; friend class GDScript; friend class GDScriptParserRef; diff --git a/modules/gdscript/gdscript_compiler.h b/modules/gdscript/gdscript_compiler.h index c9ffb04fb8..4841884e2d 100644 --- a/modules/gdscript/gdscript_compiler.h +++ b/modules/gdscript/gdscript_compiler.h @@ -31,7 +31,7 @@ #ifndef GDSCRIPT_COMPILER_H #define GDSCRIPT_COMPILER_H -#include "core/templates/rb_set.h" +#include "core/templates/hash_set.h" #include "gdscript.h" #include "gdscript_codegen.h" #include "gdscript_function.h" @@ -39,8 +39,8 @@ class GDScriptCompiler { const GDScriptParser *parser = nullptr; - RBSet<GDScript *> parsed_classes; - RBSet<GDScript *> parsing_classes; + HashSet<GDScript *> parsed_classes; + HashSet<GDScript *> parsing_classes; GDScript *main_script = nullptr; struct CodeGen { diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 72f54626e3..5b63fe7466 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -110,7 +110,7 @@ static void get_function_names_recursively(const GDScriptParser::ClassNode *p_cl } } -bool GDScriptLanguage::validate(const String &p_script, const String &p_path, List<String> *r_functions, List<ScriptLanguage::ScriptError> *r_errors, List<ScriptLanguage::Warning> *r_warnings, RBSet<int> *r_safe_lines) const { +bool GDScriptLanguage::validate(const String &p_script, const String &p_path, List<String> *r_functions, List<ScriptLanguage::ScriptError> *r_errors, List<ScriptLanguage::Warning> *r_warnings, HashSet<int> *r_safe_lines) const { GDScriptParser parser; GDScriptAnalyzer analyzer(&parser); @@ -159,7 +159,7 @@ bool GDScriptLanguage::validate(const String &p_script, const String &p_path, Li #ifdef DEBUG_ENABLED if (r_safe_lines) { - const RBSet<int> &unsafe_lines = parser.get_unsafe_lines(); + const HashSet<int> &unsafe_lines = parser.get_unsafe_lines(); for (int i = 1; i <= parser.get_last_line_number(); i++) { if (!unsafe_lines.has(i)) { r_safe_lines->insert(i); diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h index 17f87edeeb..96b9a10d3c 100644 --- a/modules/gdscript/gdscript_parser.h +++ b/modules/gdscript/gdscript_parser.h @@ -1205,9 +1205,9 @@ private: List<ParserError> errors; #ifdef DEBUG_ENABLED List<GDScriptWarning> warnings; - RBSet<String> ignored_warnings; - RBSet<uint32_t> ignored_warning_codes; - RBSet<int> unsafe_lines; + HashSet<String> ignored_warnings; + HashSet<uint32_t> ignored_warning_codes; + HashSet<int> unsafe_lines; #endif GDScriptTokenizer tokenizer; @@ -1419,7 +1419,7 @@ public: } #ifdef DEBUG_ENABLED const List<GDScriptWarning> &get_warnings() const { return warnings; } - const RBSet<int> &get_unsafe_lines() const { return unsafe_lines; } + const HashSet<int> &get_unsafe_lines() const { return unsafe_lines; } int get_last_line_number() const { return current.end_line; } #endif diff --git a/modules/gdscript/gdscript_tokenizer.h b/modules/gdscript/gdscript_tokenizer.h index ad818cf812..7fb715f2c8 100644 --- a/modules/gdscript/gdscript_tokenizer.h +++ b/modules/gdscript/gdscript_tokenizer.h @@ -32,8 +32,8 @@ #define GDSCRIPT_TOKENIZER_H #include "core/templates/hash_map.h" +#include "core/templates/hash_set.h" #include "core/templates/list.h" -#include "core/templates/rb_set.h" #include "core/templates/vector.h" #include "core/variant/variant.h" diff --git a/modules/gdscript/language_server/gdscript_workspace.cpp b/modules/gdscript/language_server/gdscript_workspace.cpp index d9de112bb0..8d484a43b3 100644 --- a/modules/gdscript/language_server/gdscript_workspace.cpp +++ b/modules/gdscript/language_server/gdscript_workspace.cpp @@ -784,7 +784,7 @@ GDScriptWorkspace::GDScriptWorkspace() { } GDScriptWorkspace::~GDScriptWorkspace() { - RBSet<String> cached_parsers; + HashSet<String> cached_parsers; for (const KeyValue<String, ExtendGDScriptParser *> &E : parse_results) { cached_parsers.insert(E.key); @@ -794,7 +794,7 @@ GDScriptWorkspace::~GDScriptWorkspace() { cached_parsers.insert(E.key); } - for (RBSet<String>::Element *E = cached_parsers.front(); E; E = E->next()) { - remove_cache_parser(E->get()); + for (const String &E : cached_parsers) { + remove_cache_parser(E); } } diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp index 7cedbda804..b230c6ba36 100644 --- a/modules/gdscript/register_types.cpp +++ b/modules/gdscript/register_types.cpp @@ -70,7 +70,7 @@ class EditorExportGDScript : public EditorExportPlugin { GDCLASS(EditorExportGDScript, EditorExportPlugin); public: - virtual void _export_file(const String &p_path, const String &p_type, const RBSet<String> &p_features) override { + virtual void _export_file(const String &p_path, const String &p_type, const HashSet<String> &p_features) override { int script_mode = EditorExportPreset::MODE_SCRIPT_COMPILED; String script_key; |