diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-25 19:29:00 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-25 19:29:00 +0100 |
commit | c51a86e9bb58ecdec31c385891961e6e6baf57e6 (patch) | |
tree | 3c1c9270783f90d90d1c92d15b1725b9b5c2a257 | |
parent | 6e693368e1bbf7a8d03a137057824b43acedb183 (diff) | |
parent | 67cdac6db82c33f30601a50e1da9d86b6c163426 (diff) |
Merge pull request #69168 from Mickeon/what-the-heck-is-this-part-2
Remove `Array.find_last()`
-rw-r--r-- | core/variant/array.cpp | 5 | ||||
-rw-r--r-- | core/variant/array.h | 1 | ||||
-rw-r--r-- | core/variant/variant_call.cpp | 1 | ||||
-rw-r--r-- | doc/classes/Array.xml | 7 | ||||
-rw-r--r-- | editor/project_converter_3_to_4.cpp | 3 |
5 files changed, 2 insertions, 15 deletions
diff --git a/core/variant/array.cpp b/core/variant/array.cpp index c6bbd43dc4..6c4e8ba450 100644 --- a/core/variant/array.cpp +++ b/core/variant/array.cpp @@ -334,11 +334,6 @@ int Array::rfind(const Variant &p_value, int p_from) const { return -1; } -int Array::find_last(const Variant &p_value) const { - ERR_FAIL_COND_V(!_p->typed.validate(p_value, "find_last"), -1); - return rfind(p_value); -} - int Array::count(const Variant &p_value) const { ERR_FAIL_COND_V(!_p->typed.validate(p_value, "count"), 0); if (_p->array.size() == 0) { diff --git a/core/variant/array.h b/core/variant/array.h index ee265a9ffd..2dd3dde2d1 100644 --- a/core/variant/array.h +++ b/core/variant/array.h @@ -90,7 +90,6 @@ public: int find(const Variant &p_value, int p_from = 0) const; int rfind(const Variant &p_value, int p_from = -1) const; - int find_last(const Variant &p_value) const; int count(const Variant &p_value) const; bool has(const Variant &p_value) const; diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp index 1e80e2681d..2cb80dcab4 100644 --- a/core/variant/variant_call.cpp +++ b/core/variant/variant_call.cpp @@ -2058,7 +2058,6 @@ static void _register_variant_builtin_methods() { bind_method(Array, pick_random, sarray(), varray()); bind_method(Array, find, sarray("what", "from"), varray(0)); bind_method(Array, rfind, sarray("what", "from"), varray(-1)); - bind_method(Array, find_last, sarray("value"), varray()); bind_method(Array, count, sarray("value"), varray()); bind_method(Array, has, sarray("value"), varray()); bind_method(Array, pop_back, sarray(), varray()); diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index 2ec37651f7..603974d619 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -300,13 +300,6 @@ Searches the array for a value and returns its index or [code]-1[/code] if not found. Optionally, the initial search index can be passed. </description> </method> - <method name="find_last" qualifiers="const"> - <return type="int" /> - <param index="0" name="value" type="Variant" /> - <description> - Searches the array in reverse order for a value and returns its index or [code]-1[/code] if not found. - </description> - </method> <method name="front" qualifiers="const"> <return type="Variant" /> <description> diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp index 90738a59e8..d42dc3c3bf 100644 --- a/editor/project_converter_3_to_4.cpp +++ b/editor/project_converter_3_to_4.cpp @@ -593,6 +593,7 @@ static const char *gdscript_function_renames[][2] = { { "is_abs_path", "is_absolute_path" }, // String { "is_valid_integer", "is_valid_int" }, // String { "linear_interpolate", "lerp" }, // Color + { "find_last", "rfind" }, // Array, String { "to_ascii", "to_ascii_buffer" }, // String { "to_utf8", "to_utf8_buffer" }, // String { "to_wchar", "to_utf32_buffer" }, // String // TODO - utf32 or utf16? @@ -2679,7 +2680,7 @@ bool ProjectConverter3To4::test_array_names() { // List of excluded functions from builtin types and global namespace, because currently it is not possible to get list of functions from them. // This will be available when https://github.com/godotengine/godot/pull/49053 or similar will be included into Godot. - static const char *builtin_types_excluded_functions[] = { "dict_to_inst", "inst_to_dict", "bytes_to_var", "bytes_to_var_with_objects", "db_to_linear", "deg_to_rad", "linear_to_db", "rad_to_deg", "randf_range", "snapped", "str_to_var", "var_to_str", "var_to_bytes", "var_to_bytes_with_objects", "move_toward", "uri_encode", "uri_decode", "remove_at", "get_rotation_quaternion", "clamp", "grow_side", "is_absolute_path", "is_valid_int", "lerp", "to_ascii_buffer", "to_utf8_buffer", "to_utf32_buffer", "snapped", "remap", nullptr }; + static const char *builtin_types_excluded_functions[] = { "dict_to_inst", "inst_to_dict", "bytes_to_var", "bytes_to_var_with_objects", "db_to_linear", "deg_to_rad", "linear_to_db", "rad_to_deg", "randf_range", "snapped", "str_to_var", "var_to_str", "var_to_bytes", "var_to_bytes_with_objects", "move_toward", "uri_encode", "uri_decode", "remove_at", "get_rotation_quaternion", "clamp", "grow_side", "is_absolute_path", "is_valid_int", "lerp", "to_ascii_buffer", "to_utf8_buffer", "to_utf32_buffer", "snapped", "remap", "rfind", nullptr }; for (int current_index = 0; builtin_types_excluded_functions[current_index]; current_index++) { all_functions.insert(builtin_types_excluded_functions[current_index]); } |