Workaround for remove/remove_at (#58)

This commit is contained in:
Rafał Mikrut 2021-07-06 17:59:07 +02:00 committed by GitHub
parent 80187caa54
commit 16ef304c5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View File

@ -257,16 +257,19 @@ func check_if_is_allowed(method_data : Dictionary) -> bool:
return true
func remove_disabled_methods(method_list : Array, exceptions : Array) -> void:
for exception in exceptions:
var index: int = -1
func remove_disabled_methods(method_list : Array, exceptions : Array) -> Array:
var new_list : Array = [] # Workaround for GH 50139 renaming remove to remove_at
for method_index in range(method_list.size()):
var index: int = -1
for exception in exceptions:
if method_list[method_index].get("name") == exception:
index = method_index
break
if index != -1:
method_list.remove(index)
if index == -1:
new_list.append(method_list[method_index])
method_list = new_list
return new_list
# Return all available classes which can be used

View File

@ -48,7 +48,7 @@ func tests_all_functions() -> void:
var method_list: Array = ClassDB.class_get_method_list(name_of_class, !use_parent_methods)
# Removes excluded methods
BasicData.remove_disabled_methods(method_list, BasicData.function_exceptions)
method_list = BasicData.remove_disabled_methods(method_list, BasicData.function_exceptions)
for _i in range(1):
for method_data in method_list: