summaryrefslogtreecommitdiff
path: root/core/object/script_language.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2021-07-24 15:46:25 +0200
committerRémi Verschelde <rverschelde@gmail.com>2021-07-25 12:22:25 +0200
commitac3322b0af8f23e8e2dac8111200bc69b5604c9f (patch)
tree59a079f13b5c03c2dd3328a26c55f3618e6014f6 /core/object/script_language.cpp
parenta0f7f42b842462646281f5c4c9a8db070e034adc (diff)
Use const references where possible for List range iterators
Diffstat (limited to 'core/object/script_language.cpp')
-rw-r--r--core/object/script_language.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp
index 5aa032192e..0fb8c7350c 100644
--- a/core/object/script_language.cpp
+++ b/core/object/script_language.cpp
@@ -63,7 +63,7 @@ Array Script::_get_script_property_list() {
Array ret;
List<PropertyInfo> list;
get_script_property_list(&list);
- for (PropertyInfo &E : list) {
+ for (const PropertyInfo &E : list) {
ret.append(E.operator Dictionary());
}
return ret;
@@ -73,7 +73,7 @@ Array Script::_get_script_method_list() {
Array ret;
List<MethodInfo> list;
get_script_method_list(&list);
- for (MethodInfo &E : list) {
+ for (const MethodInfo &E : list) {
ret.append(E.operator Dictionary());
}
return ret;
@@ -83,7 +83,7 @@ Array Script::_get_script_signal_list() {
Array ret;
List<MethodInfo> list;
get_script_signal_list(&list);
- for (MethodInfo &E : list) {
+ for (const MethodInfo &E : list) {
ret.append(E.operator Dictionary());
}
return ret;
@@ -257,7 +257,7 @@ void ScriptServer::get_global_class_list(List<StringName> *r_global_classes) {
classes.push_back(*K);
}
classes.sort_custom<StringName::AlphCompare>();
- for (StringName &E : classes) {
+ for (const StringName &E : classes) {
r_global_classes->push_back(E);
}
}
@@ -266,7 +266,7 @@ void ScriptServer::save_global_classes() {
List<StringName> gc;
get_global_class_list(&gc);
Array gcarr;
- for (StringName &E : gc) {
+ for (const StringName &E : gc) {
Dictionary d;
d["class"] = E;
d["language"] = global_classes[E].language;
@@ -297,7 +297,7 @@ void ScriptServer::save_global_classes() {
void ScriptInstance::get_property_state(List<Pair<StringName, Variant>> &state) {
List<PropertyInfo> pinfo;
get_property_list(&pinfo);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
if (E.usage & PROPERTY_USAGE_STORAGE) {
Pair<StringName, Variant> p;
p.first = E.name;