diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/debugger/remote_debugger.cpp | 2 | ||||
-rw-r--r-- | core/doc_data.h | 45 | ||||
-rw-r--r-- | core/object/ref_counted.h | 5 | ||||
-rw-r--r-- | core/os/time.cpp | 3 | ||||
-rw-r--r-- | core/register_core_types.cpp | 3 | ||||
-rw-r--r-- | core/string/char_range.inc | 4 | ||||
-rw-r--r-- | core/templates/hashfuncs.h | 4 |
7 files changed, 56 insertions, 10 deletions
diff --git a/core/debugger/remote_debugger.cpp b/core/debugger/remote_debugger.cpp index fe9e468774..6f2036705d 100644 --- a/core/debugger/remote_debugger.cpp +++ b/core/debugger/remote_debugger.cpp @@ -665,7 +665,7 @@ RemoteDebugger::RemoteDebugger(Ref<RemoteDebuggerPeer> p_peer) { // Performance Profiler Object *perf = Engine::get_singleton()->get_singleton_object("Performance"); if (perf) { - performance_profiler = Ref<PerformanceProfiler>(memnew(PerformanceProfiler(perf))); + performance_profiler.instantiate(perf); performance_profiler->bind("performance"); profiler_enable("performance", true); } diff --git a/core/doc_data.h b/core/doc_data.h index b8c92a4b67..45463f5931 100644 --- a/core/doc_data.h +++ b/core/doc_data.h @@ -117,6 +117,7 @@ public: bool is_experimental = false; Vector<ArgumentDoc> arguments; Vector<int> errors_returned; + String keywords; bool operator<(const MethodDoc &p_method) const { if (name == p_method.name) { // Must be an operator or a constructor since there is no other overloading @@ -195,6 +196,10 @@ public: doc.errors_returned.push_back(errors_returned[i]); } + if (p_dict.has("keywords")) { + doc.keywords = p_dict["keywords"]; + } + return doc; } static Dictionary to_dict(const MethodDoc &p_doc) { @@ -225,6 +230,10 @@ public: dict["is_experimental"] = p_doc.is_experimental; + if (!p_doc.keywords.is_empty()) { + dict["keywords"] = p_doc.keywords; + } + if (!p_doc.arguments.is_empty()) { Array arguments; for (int i = 0; i < p_doc.arguments.size(); i++) { @@ -254,6 +263,7 @@ public: String description; bool is_deprecated = false; bool is_experimental = false; + String keywords; bool operator<(const ConstantDoc &p_const) const { return name < p_const.name; } @@ -291,6 +301,10 @@ public: doc.is_experimental = p_dict["is_experimental"]; } + if (p_dict.has("keywords")) { + doc.keywords = p_dict["keywords"]; + } + return doc; } static Dictionary to_dict(const ConstantDoc &p_doc) { @@ -319,6 +333,10 @@ public: dict["is_experimental"] = p_doc.is_experimental; + if (!p_doc.keywords.is_empty()) { + dict["keywords"] = p_doc.keywords; + } + return dict; } }; @@ -335,6 +353,7 @@ public: String overrides; bool is_deprecated = false; bool is_experimental = false; + String keywords; bool operator<(const PropertyDoc &p_prop) const { return name.naturalcasecmp_to(p_prop.name) < 0; } @@ -388,6 +407,10 @@ public: doc.is_experimental = p_dict["is_experimental"]; } + if (p_dict.has("keywords")) { + doc.keywords = p_dict["keywords"]; + } + return doc; } static Dictionary to_dict(const PropertyDoc &p_doc) { @@ -432,6 +455,10 @@ public: dict["is_experimental"] = p_doc.is_experimental; + if (!p_doc.keywords.is_empty()) { + dict["keywords"] = p_doc.keywords; + } + return dict; } }; @@ -442,6 +469,7 @@ public: String data_type; String description; String default_value; + String keywords; bool operator<(const ThemeItemDoc &p_theme_item) const { // First sort by the data type, then by name. if (data_type == p_theme_item.data_type) { @@ -472,6 +500,10 @@ public: doc.default_value = p_dict["default_value"]; } + if (p_dict.has("keywords")) { + doc.keywords = p_dict["keywords"]; + } + return doc; } static Dictionary to_dict(const ThemeItemDoc &p_doc) { @@ -497,6 +529,10 @@ public: dict["default_value"] = p_doc.default_value; } + if (!p_doc.keywords.is_empty()) { + dict["keywords"] = p_doc.keywords; + } + return dict; } }; @@ -573,6 +609,7 @@ public: String inherits; String brief_description; String description; + String keywords; Vector<TutorialDoc> tutorials; Vector<MethodDoc> constructors; Vector<MethodDoc> methods; @@ -609,6 +646,10 @@ public: doc.description = p_dict["description"]; } + if (p_dict.has("keywords")) { + doc.keywords = p_dict["keywords"]; + } + Array tutorials; if (p_dict.has("tutorials")) { tutorials = p_dict["tutorials"]; @@ -816,6 +857,10 @@ public: dict["script_path"] = p_doc.script_path; } + if (!p_doc.keywords.is_empty()) { + dict["keywords"] = p_doc.keywords; + } + return dict; } }; diff --git a/core/object/ref_counted.h b/core/object/ref_counted.h index 228373d662..10be27b879 100644 --- a/core/object/ref_counted.h +++ b/core/object/ref_counted.h @@ -212,8 +212,9 @@ public: reference = nullptr; } - void instantiate() { - ref(memnew(T)); + template <typename... VarArgs> + void instantiate(VarArgs... p_params) { + ref(memnew(T(p_params...))); } Ref() {} diff --git a/core/os/time.cpp b/core/os/time.cpp index bad5cc2e4f..7068935d36 100644 --- a/core/os/time.cpp +++ b/core/os/time.cpp @@ -189,9 +189,6 @@ static const uint8_t MONTH_DAYS_TABLE[2][12] = { Time *Time::singleton = nullptr; Time *Time::get_singleton() { - if (!singleton) { - memnew(Time); - } return singleton; } diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index 82b3d27942..4c1ed8a69a 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -102,6 +102,7 @@ static core_bind::Marshalls *_marshalls = nullptr; static core_bind::EngineDebugger *_engine_debugger = nullptr; static IP *ip = nullptr; +static Time *_time = nullptr; static core_bind::Geometry2D *_geometry_2d = nullptr; static core_bind::Geometry3D *_geometry_3d = nullptr; @@ -128,6 +129,7 @@ void register_core_types() { ObjectDB::setup(); StringName::setup(); + _time = memnew(Time); ResourceLoader::initialize(); register_global_constants(); @@ -436,6 +438,7 @@ void unregister_core_types() { ResourceLoader::finalize(); ClassDB::cleanup_defaults(); + memdelete(_time); ObjectDB::cleanup(); Variant::unregister_types(); diff --git a/core/string/char_range.inc b/core/string/char_range.inc index be5516e243..5dffe4f20d 100644 --- a/core/string/char_range.inc +++ b/core/string/char_range.inc @@ -38,7 +38,7 @@ struct CharRange { char32_t end; }; -static CharRange xid_start[] = { +inline constexpr CharRange xid_start[] = { { 0x41, 0x5a }, { 0x5f, 0x5f }, { 0x61, 0x7a }, @@ -692,7 +692,7 @@ static CharRange xid_start[] = { { 0x0, 0x0 }, }; -static CharRange xid_continue[] = { +inline constexpr CharRange xid_continue[] = { { 0x30, 0x39 }, { 0x41, 0x5a }, { 0x5f, 0x5f }, diff --git a/core/templates/hashfuncs.h b/core/templates/hashfuncs.h index 05960292f5..a16f655524 100644 --- a/core/templates/hashfuncs.h +++ b/core/templates/hashfuncs.h @@ -429,7 +429,7 @@ struct HashMapComparatorDefault<Vector3> { constexpr uint32_t HASH_TABLE_SIZE_MAX = 29; -const uint32_t hash_table_size_primes[HASH_TABLE_SIZE_MAX] = { +inline constexpr uint32_t hash_table_size_primes[HASH_TABLE_SIZE_MAX] = { 5, 13, 23, @@ -462,7 +462,7 @@ const uint32_t hash_table_size_primes[HASH_TABLE_SIZE_MAX] = { }; // Computed with elem_i = UINT64_C (0 x FFFFFFFF FFFFFFFF ) / d_i + 1, where d_i is the i-th element of the above array. -const uint64_t hash_table_size_primes_inv[HASH_TABLE_SIZE_MAX] = { +inline constexpr uint64_t hash_table_size_primes_inv[HASH_TABLE_SIZE_MAX] = { 3689348814741910324, 1418980313362273202, 802032351030850071, |