summaryrefslogtreecommitdiffstats
path: root/core/object/method_bind.h
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-05-07 09:04:44 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-05-07 09:04:44 +0200
commite63252b4219680d109bfa41c24f483e97b37f40e (patch)
tree8b8af6d7efcab9b2692d45dec65449fd83d2c8b9 /core/object/method_bind.h
parent570220ba9b127325f1a5aa7bb17d5c6f76ccf62c (diff)
parent955d5affa857ec1f358c56da8fb1ff4ab6590704 (diff)
downloadredot-engine-e63252b4219680d109bfa41c24f483e97b37f40e.tar.gz
Merge pull request #90705 from AThousandShips/foreach_list
Reduce and prevent unnecessary random-access to `List`
Diffstat (limited to 'core/object/method_bind.h')
-rw-r--r--core/object/method_bind.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/object/method_bind.h b/core/object/method_bind.h
index e97f4abc6a..2f9a2d1679 100644
--- a/core/object/method_bind.h
+++ b/core/object/method_bind.h
@@ -152,7 +152,7 @@ public:
if (p_arg < 0) {
return _gen_return_type_info();
} else if (p_arg < method_info.arguments.size()) {
- return method_info.arguments[p_arg];
+ return method_info.arguments.get(p_arg);
} else {
return PropertyInfo(Variant::NIL, "arg_" + itos(p_arg), PROPERTY_HINT_NONE, String(), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_NIL_IS_VARIANT);
}
@@ -193,10 +193,11 @@ public:
Vector<StringName> names;
names.resize(method_info.arguments.size());
#endif
- for (int i = 0; i < method_info.arguments.size(); i++) {
- at[i + 1] = method_info.arguments[i].type;
+ int i = 0;
+ for (List<PropertyInfo>::ConstIterator itr = method_info.arguments.begin(); itr != method_info.arguments.end(); ++itr, ++i) {
+ at[i + 1] = itr->type;
#ifdef DEBUG_METHODS_ENABLED
- names.write[i] = method_info.arguments[i].name;
+ names.write[i] = itr->name;
#endif
}