summaryrefslogtreecommitdiff
path: root/modules
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 /modules
parenta0f7f42b842462646281f5c4c9a8db070e034adc (diff)
Use const references where possible for List range iterators
Diffstat (limited to 'modules')
-rw-r--r--modules/gdnative/gdnative.cpp8
-rw-r--r--modules/gdnative/nativescript/api_generator.cpp2
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp2
-rw-r--r--modules/gdnative/register_types.cpp6
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.cpp16
-rw-r--r--modules/gdscript/gdscript.cpp11
-rw-r--r--modules/gdscript/gdscript_compiler.cpp2
-rw-r--r--modules/gdscript/gdscript_editor.cpp40
-rw-r--r--modules/gdscript/gdscript_parser.cpp10
-rw-r--r--modules/gdscript/gdscript_parser.h2
-rw-r--r--modules/gdscript/language_server/gdscript_extend_parser.cpp2
-rw-r--r--modules/gdscript/language_server/gdscript_workspace.cpp4
-rw-r--r--modules/gridmap/grid_map.cpp2
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp8
-rw-r--r--modules/mono/class_db_api_json.cpp12
-rw-r--r--modules/mono/csharp_script.cpp4
-rw-r--r--modules/mono/editor/bindings_generator.cpp10
-rw-r--r--modules/mono/editor/code_completion.cpp14
-rw-r--r--modules/mono/glue/base_object_glue.cpp2
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp2
-rw-r--r--modules/text_server_adv/text_server_adv.cpp4
-rw-r--r--modules/text_server_fb/text_server_fb.cpp2
-rw-r--r--modules/visual_script/visual_script.cpp8
-rw-r--r--modules/visual_script/visual_script_editor.cpp36
-rw-r--r--modules/visual_script/visual_script_flow_control.cpp2
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp24
-rw-r--r--modules/visual_script/visual_script_nodes.cpp20
-rw-r--r--modules/visual_script/visual_script_property_selector.cpp6
-rw-r--r--modules/visual_script/visual_script_yield_nodes.cpp4
29 files changed, 132 insertions, 133 deletions
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index b585ad15bf..9445fac1c6 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -129,7 +129,7 @@ void GDNativeLibrary::_get_property_list(List<PropertyInfo> *p_list) const {
config_file->get_section_keys("entry", &entry_key_list);
}
- for (String &key : entry_key_list) {
+ for (const String &key : entry_key_list) {
PropertyInfo prop;
prop.type = Variant::STRING;
@@ -145,7 +145,7 @@ void GDNativeLibrary::_get_property_list(List<PropertyInfo> *p_list) const {
config_file->get_section_keys("dependencies", &dependency_key_list);
}
- for (String &key : dependency_key_list) {
+ for (const String &key : dependency_key_list) {
PropertyInfo prop;
prop.type = Variant::STRING;
@@ -171,7 +171,7 @@ void GDNativeLibrary::set_config_file(Ref<ConfigFile> p_config_file) {
p_config_file->get_section_keys("entry", &entry_keys);
}
- for (String &key : entry_keys) {
+ for (const String &key : entry_keys) {
Vector<String> tags = key.split(".");
bool skip = false;
@@ -201,7 +201,7 @@ void GDNativeLibrary::set_config_file(Ref<ConfigFile> p_config_file) {
p_config_file->get_section_keys("dependencies", &dependency_keys);
}
- for (String &key : dependency_keys) {
+ for (const String &key : dependency_keys) {
Vector<String> tags = key.split(".");
bool skip = false;
diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp
index 0a3225fcc5..df0f29277e 100644
--- a/modules/gdnative/nativescript/api_generator.cpp
+++ b/modules/gdnative/nativescript/api_generator.cpp
@@ -425,7 +425,7 @@ List<ClassAPI> generate_c_api_classes() {
List<EnumAPI> enums;
List<StringName> enum_names;
ClassDB::get_enum_list(class_name, &enum_names, true);
- for (StringName &E : enum_names) {
+ for (const StringName &E : enum_names) {
List<StringName> value_names;
EnumAPI enum_api;
enum_api.name = E;
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index dba348c20d..f3a0e9603f 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -98,7 +98,7 @@ void NativeScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder)
List<PropertyInfo> info;
get_script_property_list(&info);
Map<StringName, Variant> values;
- for (PropertyInfo &E : info) {
+ for (const PropertyInfo &E : info) {
Variant value;
get_property_default_value(E.name, value);
values[E.name] = value;
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index c3a6a3267f..a41c4f7b19 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -79,7 +79,7 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty
List<String> entry_keys;
config->get_section_keys("entry", &entry_keys);
- for (String &key : entry_keys) {
+ for (const String &key : entry_keys) {
Vector<String> tags = key.split(".");
bool skip = false;
@@ -110,7 +110,7 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty
List<String> dependency_keys;
config->get_section_keys("dependencies", &dependency_keys);
- for (String &key : dependency_keys) {
+ for (const String &key : dependency_keys) {
Vector<String> tags = key.split(".");
bool skip = false;
@@ -145,7 +145,7 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty
List<String> entry_keys;
config->get_section_keys("entry", &entry_keys);
- for (String &key : entry_keys) {
+ for (const String &key : entry_keys) {
Vector<String> tags = key.split(".");
bool skip = false;
diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp
index b19a57d56a..ed8b0a4690 100644
--- a/modules/gdscript/editor/gdscript_highlighter.cpp
+++ b/modules/gdscript/editor/gdscript_highlighter.cpp
@@ -458,7 +458,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
const Color types_color = EDITOR_GET("text_editor/highlighting/engine_type_color");
List<StringName> types;
ClassDB::get_class_list(&types);
- for (StringName &E : types) {
+ for (const StringName &E : types) {
String n = E;
if (n.begins_with("_")) {
n = n.substr(1, n.length());
@@ -470,7 +470,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
const Color usertype_color = EDITOR_GET("text_editor/highlighting/user_type_color");
List<StringName> global_classes;
ScriptServer::get_global_class_list(&global_classes);
- for (StringName &E : global_classes) {
+ for (const StringName &E : global_classes) {
keywords[String(E)] = usertype_color;
}
@@ -489,7 +489,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
const Color basetype_color = EDITOR_GET("text_editor/highlighting/base_type_color");
List<String> core_types;
gdscript->get_core_type_words(&core_types);
- for (String &E : core_types) {
+ for (const String &E : core_types) {
keywords[E] = basetype_color;
}
@@ -498,7 +498,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
const Color control_flow_keyword_color = EDITOR_GET("text_editor/highlighting/control_flow_keyword_color");
List<String> keyword_list;
gdscript->get_reserved_words(&keyword_list);
- for (String &E : keyword_list) {
+ for (const String &E : keyword_list) {
if (gdscript->is_control_flow_keyword(E)) {
keywords[E] = control_flow_keyword_color;
} else {
@@ -510,7 +510,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
const Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color");
List<String> comments;
gdscript->get_comment_delimiters(&comments);
- for (String &comment : comments) {
+ for (const String &comment : comments) {
String beg = comment.get_slice(" ", 0);
String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String();
add_color_region(beg, end, comment_color, end == "");
@@ -520,7 +520,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
const Color string_color = EDITOR_GET("text_editor/highlighting/string_color");
List<String> strings;
gdscript->get_string_delimiters(&strings);
- for (String &string : strings) {
+ for (const String &string : strings) {
String beg = string.get_slice(" ", 0);
String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String();
add_color_region(beg, end, string_color, end == "");
@@ -534,7 +534,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
if (instance_base != StringName()) {
List<PropertyInfo> plist;
ClassDB::get_property_list(instance_base, &plist);
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
String name = E.name;
if (E.usage & PROPERTY_USAGE_CATEGORY || E.usage & PROPERTY_USAGE_GROUP || E.usage & PROPERTY_USAGE_SUBGROUP) {
continue;
@@ -547,7 +547,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
List<String> clist;
ClassDB::get_integer_constant_list(instance_base, &clist);
- for (String &E : clist) {
+ for (const String &E : clist) {
member_keywords[E] = member_variable_color;
}
}
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 79cc90b92f..b3975fa95c 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -291,7 +291,7 @@ void GDScript::_get_script_property_list(List<PropertyInfo> *r_list, bool p_incl
sptr = sptr->_base;
}
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
r_list->push_back(E);
}
}
@@ -401,7 +401,7 @@ void GDScript::_update_exports_values(Map<StringName, Variant> &values, List<Pro
values[E->key()] = E->get();
}
- for (PropertyInfo &E : members_cache) {
+ for (const PropertyInfo &E : members_cache) {
propnames.push_back(E);
}
}
@@ -861,8 +861,7 @@ Error GDScript::reload(bool p_keep_state) {
}
}
#ifdef DEBUG_ENABLED
- for (const GDScriptWarning &E : parser.get_warnings()) {
- const GDScriptWarning &warning = E;
+ for (const GDScriptWarning &warning : parser.get_warnings()) {
if (EngineDebugger::is_active()) {
Vector<ScriptLanguage::StackInfo> si;
EngineDebugger::get_script_debugger()->send_error("", get_path(), warning.start_line, warning.get_name(), warning.get_message(), ERR_HANDLER_WARNING, si);
@@ -1445,7 +1444,7 @@ void GDScriptInstance::get_property_list(List<PropertyInfo> *p_properties) const
sptr = sptr->_base;
}
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
p_properties->push_back(E);
}
}
@@ -1661,7 +1660,7 @@ void GDScriptLanguage::init() {
List<Engine::Singleton> singletons;
Engine::get_singleton()->get_singletons(&singletons);
- for (Engine::Singleton &E : singletons) {
+ for (const Engine::Singleton &E : singletons) {
_add_global(E.name, E.ptr);
}
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index 3289f8978b..7c9d08b782 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -981,7 +981,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
assigned = prev_base;
// Set back the values into their bases.
- for (ChainInfo &info : set_chain) {
+ for (const ChainInfo &info : set_chain) {
if (!info.is_named) {
gen->write_set(info.base, info.key, assigned);
if (info.key.mode == GDScriptCodeGenerator::Address::TEMPORARY) {
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 3ac9db3645..2a93bb620b 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -319,7 +319,7 @@ void GDScriptLanguage::debug_get_stack_level_locals(int p_level, List<String> *p
List<Pair<StringName, int>> locals;
f->debug_get_stack_member_state(*_call_stack[l].line, &locals);
- for (Pair<StringName, int> &E : locals) {
+ for (const Pair<StringName, int> &E : locals) {
p_locals->push_back(E.first);
p_values->push_back(_call_stack[l].stack[E.second]);
}
@@ -865,7 +865,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
if (!_static) {
List<PropertyInfo> members;
scr->get_script_property_list(&members);
- for (PropertyInfo &E : members) {
+ for (const PropertyInfo &E : members) {
ScriptCodeCompletionOption option(E.name, ScriptCodeCompletionOption::KIND_MEMBER);
r_result.insert(option.display, option);
}
@@ -879,7 +879,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
List<MethodInfo> signals;
scr->get_script_signal_list(&signals);
- for (MethodInfo &E : signals) {
+ for (const MethodInfo &E : signals) {
ScriptCodeCompletionOption option(E.name, ScriptCodeCompletionOption::KIND_SIGNAL);
r_result.insert(option.display, option);
}
@@ -887,7 +887,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
List<MethodInfo> methods;
scr->get_script_method_list(&methods);
- for (MethodInfo &E : methods) {
+ for (const MethodInfo &E : methods) {
if (E.name.begins_with("@")) {
continue;
}
@@ -920,7 +920,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
if (!p_only_functions) {
List<String> constants;
ClassDB::get_integer_constant_list(type, &constants);
- for (String &E : constants) {
+ for (const String &E : constants) {
ScriptCodeCompletionOption option(E, ScriptCodeCompletionOption::KIND_CONSTANT);
r_result.insert(option.display, option);
}
@@ -928,7 +928,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
if (!_static || Engine::get_singleton()->has_singleton(type)) {
List<PropertyInfo> pinfo;
ClassDB::get_property_list(type, &pinfo);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
if (E.usage & (PROPERTY_USAGE_GROUP | PROPERTY_USAGE_CATEGORY)) {
continue;
}
@@ -945,7 +945,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
List<MethodInfo> methods;
bool is_autocompleting_getters = GLOBAL_GET("debug/gdscript/completion/autocomplete_setters_and_getters").booleanize();
ClassDB::get_method_list(type, &methods, false, !is_autocompleting_getters);
- for (MethodInfo &E : methods) {
+ for (const MethodInfo &E : methods) {
if (E.name.begins_with("_")) {
continue;
}
@@ -977,7 +977,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
tmp.get_property_list(&members);
}
- for (PropertyInfo &E : members) {
+ for (const PropertyInfo &E : members) {
if (String(E.name).find("/") == -1) {
ScriptCodeCompletionOption option(E.name, ScriptCodeCompletionOption::KIND_MEMBER);
r_result.insert(option.display, option);
@@ -2095,7 +2095,7 @@ static bool _guess_method_return_type_from_base(GDScriptParser::CompletionContex
if (scr.is_valid()) {
List<MethodInfo> methods;
scr->get_script_method_list(&methods);
- for (MethodInfo &mi : methods) {
+ for (const MethodInfo &mi : methods) {
if (mi.name == p_method) {
r_type = _type_from_property(mi.return_val);
return true;
@@ -2135,7 +2135,7 @@ static bool _guess_method_return_type_from_base(GDScriptParser::CompletionContex
List<MethodInfo> methods;
tmp.get_method_list(&methods);
- for (MethodInfo &mi : methods) {
+ for (const MethodInfo &mi : methods) {
if (mi.name == p_method) {
r_type = _type_from_property(mi.return_val);
return true;
@@ -2180,7 +2180,7 @@ static void _find_enumeration_candidates(GDScriptParser::CompletionContext &p_co
List<StringName> enum_constants;
ClassDB::get_enum_constants(class_name, enum_name, &enum_constants);
- for (StringName &E : enum_constants) {
+ for (const StringName &E : enum_constants) {
String candidate = class_name + "." + E;
ScriptCodeCompletionOption option(candidate, ScriptCodeCompletionOption::KIND_ENUM);
r_result.insert(option.display, option);
@@ -2225,7 +2225,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
if (obj) {
List<String> options;
obj->get_argument_options(p_method, p_argidx, &options);
- for (String &F : options) {
+ for (const String &F : options) {
ScriptCodeCompletionOption option(F, ScriptCodeCompletionOption::KIND_FUNCTION);
r_result.insert(option.display, option);
}
@@ -2247,7 +2247,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
List<PropertyInfo> props;
ProjectSettings::get_singleton()->get_property_list(&props);
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
String s = E.name;
if (!s.begins_with("autoload/")) {
continue;
@@ -2263,7 +2263,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
// Get input actions
List<PropertyInfo> props;
ProjectSettings::get_singleton()->get_property_list(&props);
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
String s = E.name;
if (!s.begins_with("input/")) {
continue;
@@ -2288,7 +2288,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
List<MethodInfo> methods;
base.get_method_list(&methods);
- for (MethodInfo &E : methods) {
+ for (const MethodInfo &E : methods) {
if (E.name == p_method) {
r_arghint = _make_arguments_hint(E, p_argidx);
return;
@@ -2337,7 +2337,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
Variant::get_constructor_list(GDScriptParser::get_builtin_type(call->function_name), &constructors);
int i = 0;
- for (MethodInfo &E : constructors) {
+ for (const MethodInfo &E : constructors) {
if (p_argidx >= E.arguments.size()) {
continue;
}
@@ -2603,7 +2603,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
List<MethodInfo> virtual_methods;
ClassDB::get_virtual_methods(class_name, &virtual_methods);
- for (MethodInfo &mi : virtual_methods) {
+ for (const MethodInfo &mi : virtual_methods) {
String method_hint = mi.name;
if (method_hint.find(":") != -1) {
method_hint = method_hint.get_slice(":", 0);
@@ -2652,7 +2652,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
List<String> opts;
p_owner->get_argument_options("get_node", 0, &opts);
- for (String &E : opts) {
+ for (const String &E : opts) {
String opt = E.strip_edges();
if (opt.is_quoted()) {
r_forced = true;
@@ -2837,7 +2837,7 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
List<MethodInfo> virtual_methods;
ClassDB::get_virtual_methods(class_name, &virtual_methods, true);
- for (MethodInfo &E : virtual_methods) {
+ for (const MethodInfo &E : virtual_methods) {
if (E.name == p_symbol) {
r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_METHOD;
r_result.class_name = base_type.native_type;
@@ -2856,7 +2856,7 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
List<String> constants;
ClassDB::get_integer_constant_list(class_name, &constants, true);
- for (String &E : constants) {
+ for (const String &E : constants) {
if (E == p_symbol) {
r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_CONSTANT;
r_result.class_name = base_type.native_type;
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 9949d0db56..466ddb4b10 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -1332,7 +1332,7 @@ GDScriptParser::AnnotationNode *GDScriptParser::parse_annotation(uint32_t p_vali
}
void GDScriptParser::clear_unused_annotations() {
- for (AnnotationNode *annotation : annotation_stack) {
+ for (const AnnotationNode *annotation : annotation_stack) {
push_error(vformat(R"(Annotation "%s" does not precedes a valid target, so it will have no effect.)", annotation->name), annotation);
}
@@ -1795,7 +1795,7 @@ GDScriptParser::MatchBranchNode *GDScriptParser::parse_match_branch() {
List<StringName> binds;
branch->patterns[0]->binds.get_key_list(&binds);
- for (StringName &E : binds) {
+ for (const StringName &E : binds) {
SuiteNode::Local local(branch->patterns[0]->binds[E], current_function);
suite->add_local(local);
}
@@ -3617,7 +3617,7 @@ void GDScriptParser::TreePrinter::push_text(const String &p_text) {
printed += p_text;
}
-void GDScriptParser::TreePrinter::print_annotation(AnnotationNode *p_annotation) {
+void GDScriptParser::TreePrinter::print_annotation(const AnnotationNode *p_annotation) {
push_text(p_annotation->name);
push_text(" (");
for (int i = 0; i < p_annotation->arguments.size(); i++) {
@@ -3992,7 +3992,7 @@ void GDScriptParser::TreePrinter::print_for(ForNode *p_for) {
}
void GDScriptParser::TreePrinter::print_function(FunctionNode *p_function, const String &p_context) {
- for (AnnotationNode *E : p_function->annotations) {
+ for (const AnnotationNode *E : p_function->annotations) {
print_annotation(E);
}
push_text(p_context);
@@ -4332,7 +4332,7 @@ void GDScriptParser::TreePrinter::print_unary_op(UnaryOpNode *p_unary_op) {
}
void GDScriptParser::TreePrinter::print_variable(VariableNode *p_variable) {
- for (AnnotationNode *E : p_variable->annotations) {
+ for (const AnnotationNode *E : p_variable->annotations) {
print_annotation(E);
}
diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h
index 043d87c705..6a227a55e5 100644
--- a/modules/gdscript/gdscript_parser.h
+++ b/modules/gdscript/gdscript_parser.h
@@ -1431,7 +1431,7 @@ public:
void push_line(const String &p_line = String());
void push_text(const String &p_text);
- void print_annotation(AnnotationNode *p_annotation);
+ void print_annotation(const AnnotationNode *p_annotation);
void print_array(ArrayNode *p_array);
void print_assert(AssertNode *p_assert);
void print_assignment(AssignmentNode *p_assignment);
diff --git a/modules/gdscript/language_server/gdscript_extend_parser.cpp b/modules/gdscript/language_server/gdscript_extend_parser.cpp
index eb68e38840..b3469ec47c 100644
--- a/modules/gdscript/language_server/gdscript_extend_parser.cpp
+++ b/modules/gdscript/language_server/gdscript_extend_parser.cpp
@@ -465,7 +465,7 @@ String ExtendGDScriptParser::parse_documentation(int p_line, bool p_docs_down) {
}
String doc;
- for (String &E : doc_lines) {
+ for (const String &E : doc_lines) {
doc += E + "\n";
}
return doc;
diff --git a/modules/gdscript/language_server/gdscript_workspace.cpp b/modules/gdscript/language_server/gdscript_workspace.cpp
index eb60433859..e6c819b22f 100644
--- a/modules/gdscript/language_server/gdscript_workspace.cpp
+++ b/modules/gdscript/language_server/gdscript_workspace.cpp
@@ -119,7 +119,7 @@ const lsp::DocumentSymbol *GDScriptWorkspace::get_script_symbol(const String &p_
void GDScriptWorkspace::reload_all_workspace_scripts() {
List<String> paths;
list_script_files("res://", paths);
- for (String &path : paths) {
+ for (const String &path : paths) {
Error err;
String content = FileAccess::get_file_as_string(path, &err);
ERR_CONTINUE(err != OK);
@@ -586,7 +586,7 @@ Error GDScriptWorkspace::resolve_signature(const lsp::TextDocumentPositionParams
GDScriptLanguageProtocol::get_singleton()->get_workspace()->resolve_related_symbols(text_pos, symbols);
}
- for (const lsp::DocumentSymbol *symbol : symbols) {
+ for (const lsp::DocumentSymbol *const &symbol : symbols) {
if (symbol->kind == lsp::SymbolKind::Method || symbol->kind == lsp::SymbolKind::Function) {
lsp::SignatureInformation signature_info;
signature_info.label = symbol->detail;
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index ca461566d3..fea513c820 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -519,7 +519,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
RS::get_singleton()->multimesh_set_mesh(mm, mesh_library->get_item_mesh(E->key())->get_rid());
int idx = 0;
- for (Pair<Transform3D, IndexKey> &F : E->get()) {
+ for (const Pair<Transform3D, IndexKey> &F : E->get()) {
RS::get_singleton()->multimesh_instance_set_transform(mm, idx, F.first);
#ifdef TOOLS_ENABLED
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 9530122e04..989c2d295c 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -497,7 +497,7 @@ void GridMapEditor::_fill_selection() {
}
void GridMapEditor::_clear_clipboard_data() {
- for (ClipboardItem &E : clipboard_items) {
+ for (const ClipboardItem &E : clipboard_items) {
RenderingServer::get_singleton()->free(E.instance);
}
@@ -552,7 +552,7 @@ void GridMapEditor::_update_paste_indicator() {
RenderingServer::get_singleton()->instance_set_transform(paste_instance, node->get_global_transform() * xf);
- for (ClipboardItem &item : clipboard_items) {
+ for (const ClipboardItem &item : clipboard_items) {
xf = Transform3D();
xf.origin = (paste_indicator.begin + (paste_indicator.current - paste_indicator.click) + center) * node->get_cell_size();
xf.basis = rot * xf.basis;
@@ -576,7 +576,7 @@ void GridMapEditor::_do_paste() {
Vector3 ofs = paste_indicator.current - paste_indicator.click;
undo_redo->create_action(TTR("GridMap Paste Selection"));
- for (ClipboardItem &item : clipboard_items) {
+ for (const ClipboardItem &item : clipboard_items) {
Vector3 position = rot.xform(item.grid_offset) + paste_indicator.begin + ofs;
Basis orm;
@@ -659,7 +659,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
if ((mb->get_button_index() == MOUSE_BUTTON_RIGHT && input_action == INPUT_ERASE) || (mb->get_button_index() == MOUSE_BUTTON_LEFT && input_action == INPUT_PAINT)) {
if (set_items.size()) {
undo_redo->create_action(TTR("GridMap Paint"));
- for (SetItem &si : set_items) {
+ for (const SetItem &si : set_items) {
undo_redo->add_do_method(node, "set_cell_item", si.position, si.new_value, si.new_orientation);
}
for (List<SetItem>::Element *E = set_items.back(); E; E = E->prev()) {
diff --git a/modules/mono/class_db_api_json.cpp b/modules/mono/class_db_api_json.cpp
index 01d0e13515..0da06131af 100644
--- a/modules/mono/class_db_api_json.cpp
+++ b/modules/mono/class_db_api_json.cpp
@@ -50,7 +50,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
//must be alphabetically sorted for hash to compute
names.sort_custom<StringName::AlphCompare>();
- for (StringName &E : names) {
+ for (const StringName &E : names) {
ClassDB::ClassInfo *t = ClassDB::classes.getptr(E);
ERR_FAIL_COND(!t);
if (t->api != p_api || !t->exposed) {
@@ -84,7 +84,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
Array methods;
- for (StringName &F : snames) {
+ for (const StringName &F : snames) {
Dictionary method_dict;
methods.push_back(method_dict);
@@ -141,7 +141,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
Array constants;
- for (StringName &F : snames) {
+ for (const StringName &F : snames) {
Dictionary constant_dict;
constants.push_back(constant_dict);
@@ -168,7 +168,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
Array signals;
- for (StringName &F : snames) {
+ for (const StringName &F : snames) {
Dictionary signal_dict;
signals.push_back(signal_dict);
@@ -203,7 +203,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
Array properties;
- for (StringName &F : snames) {
+ for (const StringName &F : snames) {
Dictionary property_dict;
properties.push_back(property_dict);
@@ -222,7 +222,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
Array property_list;
//property list
- for (PropertyInfo &F : t->property_list) {
+ for (const PropertyInfo &F : t->property_list) {
Dictionary property_dict;
property_list.push_back(property_dict);
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 0eea0f543b..b52277974f 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -1731,7 +1731,7 @@ void CSharpInstance::get_properties_state_for_reloading(List<Pair<StringName, Va
List<PropertyInfo> pinfo;
get_property_list(&pinfo);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
Pair<StringName, Variant> state_pair;
state_pair.first = E.name;
@@ -2313,7 +2313,7 @@ void CSharpScript::_update_exports_values(Map<StringName, Variant> &values, List
values[E->key()] = E->get();
}
- for (PropertyInfo &E : exported_members_cache) {
+ for (const PropertyInfo &E : exported_members_cache) {
propnames.push_back(E);
}
}
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index 6ae7c88213..6ea0b56908 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -682,7 +682,7 @@ int BindingsGenerator::_determine_enum_prefix(const EnumInterface &p_ienum) {
void BindingsGenerator::_apply_prefix_to_enum_constants(BindingsGenerator::EnumInterface &p_ienum, int p_prefix_length) {
if (p_prefix_length > 0) {
- for (ConstantInterface &E : p_ienum.constants) {
+ for (const ConstantInterface &E : p_ienum.constants) {
int curr_prefix_length = p_prefix_length;
ConstantInterface &curr_const = E;
@@ -890,7 +890,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) {
// Enums
- for (EnumInterface &ienum : global_enums) {
+ for (const EnumInterface &ienum : global_enums) {
CRASH_COND(ienum.constants.is_empty());
String enum_proxy_name = ienum.cname.operator String();
@@ -2668,7 +2668,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
ClassDB::get_method_list(type_cname, &method_list, true);
method_list.sort();
- for (MethodInfo &E : method_list) {
+ for (const MethodInfo &E : method_list) {
const MethodInfo &method_info = E;
int argc = method_info.arguments.size();
@@ -3523,7 +3523,7 @@ void BindingsGenerator::_populate_global_constants() {
}
}
- for (EnumInterface &ienum : global_enums) {
+ for (const EnumInterface &ienum : global_enums) {
TypeInterface enum_itype;
enum_itype.is_enum = true;
enum_itype.name = ienum.cname.operator String();
@@ -3553,7 +3553,7 @@ void BindingsGenerator::_populate_global_constants() {
hardcoded_enums.push_back("Vector2i.Axis");
hardcoded_enums.push_back("Vector3.Axis");
hardcoded_enums.push_back("Vector3i.Axis");
- for (StringName &E : hardcoded_enums) {
+ for (const StringName &E : hardcoded_enums) {
// These enums are not generated and must be written manually (e.g.: Vector3.Axis)
// Here, we assume core types do not begin with underscore
TypeInterface enum_itype;
diff --git a/modules/mono/editor/code_completion.cpp b/modules/mono/editor/code_completion.cpp
index 308c15e7c9..fa7d418844 100644
--- a/modules/mono/editor/code_completion.cpp
+++ b/modules/mono/editor/code_completion.cpp
@@ -109,7 +109,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
List<PropertyInfo> project_props;
ProjectSettings::get_singleton()->get_property_list(&project_props);
- for (PropertyInfo &prop : project_props) {
+ for (const PropertyInfo &prop : project_props) {
if (!prop.name.begins_with("input/")) {
continue;
}
@@ -185,7 +185,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
ClassDB::get_signal_list(native, &signals, /* p_no_inheritance: */ false);
}
- for (MethodInfo &E : signals) {
+ for (const MethodInfo &E : signals) {
const String &signal = E.name;
suggestions.push_back(quoted(signal));
}
@@ -197,7 +197,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
List<StringName> sn;
Theme::get_default()->get_color_list(base->get_class(), &sn);
- for (StringName &E : sn) {
+ for (const StringName &E : sn) {
suggestions.push_back(quoted(E));
}
}
@@ -209,7 +209,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
List<StringName> sn;
Theme::get_default()->get_constant_list(base->get_class(), &sn);
- for (StringName &E : sn) {
+ for (const StringName &E : sn) {
suggestions.push_back(quoted(E));
}
}
@@ -221,7 +221,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
List<StringName> sn;
Theme::get_default()->get_font_list(base->get_class(), &sn);
- for (StringName &E : sn) {
+ for (const StringName &E : sn) {
suggestions.push_back(quoted(E));
}
}
@@ -233,7 +233,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
List<StringName> sn;
Theme::get_default()->get_font_size_list(base->get_class(), &sn);
- for (StringName &E : sn) {
+ for (const StringName &E : sn) {
suggestions.push_back(quoted(E));
}
}
@@ -245,7 +245,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
List<StringName> sn;
Theme::get_default()->get_stylebox_list(base->get_class(), &sn);
- for (StringName &E : sn) {
+ for (const StringName &E : sn) {
suggestions.push_back(quoted(E));
}
}
diff --git a/modules/mono/glue/base_object_glue.cpp b/modules/mono/glue/base_object_glue.cpp
index 358e390784..a99dff8432 100644
--- a/modules/mono/glue/base_object_glue.cpp
+++ b/modules/mono/glue/base_object_glue.cpp
@@ -177,7 +177,7 @@ MonoArray *godot_icall_DynamicGodotObject_SetMemberList(Object *p_ptr) {
MonoArray *result = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(String), property_list.size());
int i = 0;
- for (PropertyInfo &E : property_list) {
+ for (const PropertyInfo &E : property_list) {
MonoString *boxed = GDMonoMarshal::mono_string_from_godot(E.name);
mono_array_setref(result, i, boxed);
i++;
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index d7c5850005..299344bb93 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -100,7 +100,7 @@ void gd_mono_setup_runtime_main_args() {
main_args.write[0] = execpath.ptrw();
int i = 1;
- for (String &E : cmdline_args) {
+ for (const String &E : cmdline_args) {
CharString &stored = cmdline_args_utf8.push_back(E.utf8())->get();
main_args.write[i] = stored.ptrw();
i++;
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp
index 6493464759..fa4888f843 100644
--- a/modules/text_server_adv/text_server_adv.cpp
+++ b/modules/text_server_adv/text_server_adv.cpp
@@ -927,13 +927,13 @@ void TextServerAdvanced::font_set_oversampling(float p_oversampling) {
oversampling = p_oversampling;
List<RID> fonts;
font_owner.get_owned_list(&fonts);
- for (RID E : fonts) {
+ for (const RID &E : fonts) {
font_owner.getornull(E)->clear_cache();
}
List<RID> text_bufs;
shaped_owner.get_owned_list(&text_bufs);
- for (RID E : text_bufs) {
+ for (const RID &E : text_bufs) {
invalidate(shaped_owner.getornull(E));
}
}
diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp
index cc90dfb4b8..004cbc2bb3 100644
--- a/modules/text_server_fb/text_server_fb.cpp
+++ b/modules/text_server_fb/text_server_fb.cpp
@@ -473,7 +473,7 @@ void TextServerFallback::font_set_oversampling(float p_oversampling) {
oversampling = p_oversampling;
List<RID> fonts;
font_owner.get_owned_list(&fonts);
- for (RID E : fonts) {
+ for (const RID &E : fonts) {
font_owner.getornull(E)->clear_cache();
}
}
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 5828529103..7a2404fd80 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -752,7 +752,7 @@ void VisualScript::_update_placeholders() {
List<StringName> keys;
variables.get_key_list(&keys);
- for (StringName &E : keys) {
+ for (const StringName &E : keys) {
if (!variables[E]._export) {
continue;
}
@@ -874,7 +874,7 @@ void VisualScript::get_script_method_list(List<MethodInfo> *p_list) const {
List<StringName> funcs;
functions.get_key_list(&funcs);
- for (StringName &E : funcs) {
+ for (const StringName &E : funcs) {
MethodInfo mi;
mi.name = E;
if (functions[E].func_id >= 0) {
@@ -928,7 +928,7 @@ void VisualScript::get_script_property_list(List<PropertyInfo> *p_list) const {
List<StringName> vars;
get_variable_list(&vars);
- for (StringName &E : vars) {
+ for (const StringName &E : vars) {
//if (!variables[E]._export)
// continue;
PropertyInfo pi = variables[E].info;
@@ -2467,7 +2467,7 @@ void VisualScriptLanguage::debug_get_stack_level_members(int p_level, List<Strin
List<StringName> vars;
vs->get_variable_list(&vars);
- for (StringName &E : vars) {
+ for (const StringName &E : vars) {
Variant v;
if (_call_stack[l].instance->get_variable(E, &v)) {
p_members->push_back("variables/" + E);
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 16313d58d0..00dba117fb 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -561,7 +561,7 @@ void VisualScriptEditor::_update_graph_connections() {
List<VisualScript::SequenceConnection> sequence_conns;
script->get_sequence_connection_list(&sequence_conns);
- for (VisualScript::SequenceConnection &E : sequence_conns) {
+ for (const VisualScript::SequenceConnection &E : sequence_conns) {
graph->connect_node(itos(E.from_node), E.from_output, itos(E.to_node), 0);
}
@@ -1045,7 +1045,7 @@ void VisualScriptEditor::_update_members() {
List<StringName> func_names;
script->get_function_list(&func_names);
func_names.sort_custom<StringName::AlphCompare>();
- for (StringName &E : func_names) {
+ for (const StringName &E : func_names) {
TreeItem *ti = members->create_item(functions);
ti->set_text(0, E);
ti->set_selectable(0, true);
@@ -1099,7 +1099,7 @@ void VisualScriptEditor::_update_members() {
List<StringName> var_names;
script->get_variable_list(&var_names);
- for (StringName &E : var_names) {
+ for (const StringName &E : var_names) {
TreeItem *ti = members->create_item(variables);
ti->set_text(0, E);
@@ -1123,7 +1123,7 @@ void VisualScriptEditor::_update_members() {
List<StringName> signal_names;
script->get_custom_signal_list(&signal_names);
- for (StringName &E : signal_names) {
+ for (const StringName &E : signal_names) {
TreeItem *ti = members->create_item(_signals);
ti->set_text(0, E);
ti->set_selectable(0, true);
@@ -1705,7 +1705,7 @@ void VisualScriptEditor::_on_nodes_delete() {
List<VisualScript::SequenceConnection> sequence_conns;
script->get_sequence_connection_list(&sequence_conns);
- for (VisualScript::SequenceConnection &E : sequence_conns) {
+ for (const VisualScript::SequenceConnection &E : sequence_conns) {
if (E.from_node == cr_node || E.to_node == cr_node) {
undo_redo->add_undo_method(script.ptr(), "sequence_connect", E.from_node, E.from_output, E.to_node);
}
@@ -1714,7 +1714,7 @@ void VisualScriptEditor::_on_nodes_delete() {
List<VisualScript::DataConnection> data_conns;
script->get_data_connection_list(&data_conns);
- for (VisualScript::DataConnection &E : data_conns) {
+ for (const VisualScript::DataConnection &E : data_conns) {
if (E.from_node == F || E.to_node == F) {
undo_redo->add_undo_method(script.ptr(), "data_connect", E.from_node, E.from_port, E.to_node, E.to_port);
}
@@ -1765,7 +1765,7 @@ void VisualScriptEditor::_on_nodes_duplicate() {
List<VisualScript::SequenceConnection> seqs;
script->get_sequence_connection_list(&seqs);
- for (VisualScript::SequenceConnection &E : seqs) {
+ for (const VisualScript::SequenceConnection &E : seqs) {
if (to_duplicate.has(E.from_node) && to_duplicate.has(E.to_node)) {
undo_redo->add_do_method(script.ptr(), "sequence_connect", remap[E.from_node], E.from_output, remap[E.to_node]);
}
@@ -1773,7 +1773,7 @@ void VisualScriptEditor::_on_nodes_duplicate() {
List<VisualScript::DataConnection> data;
script->get_data_connection_list(&data);
- for (VisualScript::DataConnection &E : data) {
+ for (const VisualScript::DataConnection &E : data) {
if (to_duplicate.has(E.from_node) && to_duplicate.has(E.to_node)) {
undo_redo->add_do_method(script.ptr(), "data_connect", remap[E.from_node], E.from_port, remap[E.to_node], E.to_port);
}
@@ -2552,7 +2552,7 @@ void VisualScriptEditor::goto_line(int p_line, bool p_with_error) {
List<StringName> functions;
script->get_function_list(&functions);
- for (StringName &E : functions) {
+ for (const StringName &E : functions) {
if (script->has_node(p_line)) {
_update_graph();
_update_members();
@@ -2773,7 +2773,7 @@ void VisualScriptEditor::_remove_node(int p_id) {
List<VisualScript::SequenceConnection> sequence_conns;
script->get_sequence_connection_list(&sequence_conns);
- for (VisualScript::SequenceConnection &E : sequence_conns) {
+ for (const VisualScript::SequenceConnection &E : sequence_conns) {
if (E.from_node == p_id || E.to_node == p_id) {
undo_redo->add_undo_method(script.ptr(), "sequence_connect", E.from_node, E.from_output, E.to_node);
}
@@ -2782,7 +2782,7 @@ void VisualScriptEditor::_remove_node(int p_id) {
List<VisualScript::DataConnection> data_conns;
script->get_data_connection_list(&data_conns);
- for (VisualScript::DataConnection &E : data_conns) {
+ for (const VisualScript::DataConnection &E : data_conns) {
if (E.from_node == p_id || E.to_node == p_id) {
undo_redo->add_undo_method(script.ptr(), "data_connect", E.from_node, E.from_port, E.to_node, E.to_port);
}
@@ -2802,7 +2802,7 @@ bool VisualScriptEditor::node_has_sequence_connections(int p_id) {
List<VisualScript::SequenceConnection> sequence_conns;
script->get_sequence_connection_list(&sequence_conns);
- for (VisualScript::SequenceConnection &E : sequence_conns) {
+ for (const VisualScript::SequenceConnection &E : sequence_conns) {
int from = E.from_node;
int to = E.to_node;
@@ -3460,7 +3460,7 @@ void VisualScriptEditor::_selected_new_virtual_method(const String &p_text, cons
List<MethodInfo> methods;
bool found = false;
ClassDB::get_virtual_methods(script->get_instance_base_type(), &methods);
- for (MethodInfo &E : methods) {
+ for (const MethodInfo &E : methods) {
if (E.name == name) {
minfo = E;
found = true;
@@ -3732,7 +3732,7 @@ void VisualScriptEditor::_menu_option(int p_what) {
_update_graph();
- for (String &E : reselect) {
+ for (const String &E : reselect) {
GraphNode *gn = Object::cast_to<GraphNode>(graph->get_node(E));
gn->set_selected(true);
}
@@ -3772,7 +3772,7 @@ void VisualScriptEditor::_menu_option(int p_what) {
List<VisualScript::SequenceConnection> sequence_connections;
script->get_sequence_connection_list(&sequence_connections);
- for (VisualScript::SequenceConnection &E : sequence_connections) {
+ for (const VisualScript::SequenceConnection &E : sequence_connections) {
if (clipboard->nodes.has(E.from_node) && clipboard->nodes.has(E.to_node)) {
clipboard->sequence_connections.insert(E);
}
@@ -3781,7 +3781,7 @@ void VisualScriptEditor::_menu_option(int p_what) {
List<VisualScript::DataConnection> data_connections;
script->get_data_connection_list(&data_connections);
- for (VisualScript::DataConnection &E : data_connections) {
+ for (const VisualScript::DataConnection &E : data_connections) {
if (clipboard->nodes.has(E.from_node) && clipboard->nodes.has(E.to_node)) {
clipboard->data_connections.insert(E);
}
@@ -3933,7 +3933,7 @@ void VisualScriptEditor::_menu_option(int p_what) {
// Pick the node with input sequence.
Set<int> nodes_from;
Set<int> nodes_to;
- for (VisualScript::SequenceConnection &E : seqs) {
+ for (const VisualScript::SequenceConnection &E : seqs) {
if (nodes.has(E.from_node) && nodes.has(E.to_node)) {
seqmove.insert(E);
nodes_from.insert(E.from_node);
@@ -3976,7 +3976,7 @@ void VisualScriptEditor::_menu_option(int p_what) {
{
List<VisualScript::DataConnection> dats;
script->get_data_connection_list(&dats);
- for (VisualScript::DataConnection &E : dats) {
+ for (const VisualScript::DataConnection &E : dats) {
if (nodes.has(E.from_node) && nodes.has(E.to_node)) {
datamove.insert(E);
} else if (!nodes.has(E.from_node) && nodes.has(E.to_node)) {
diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp
index ddf6169015..62a4f465cb 100644
--- a/modules/visual_script/visual_script_flow_control.cpp
+++ b/modules/visual_script/visual_script_flow_control.cpp
@@ -852,7 +852,7 @@ void VisualScriptTypeCast::_bind_methods() {
}
String script_ext_hint;
- for (String &E : script_extensions) {
+ for (const String &E : script_extensions) {
if (script_ext_hint != String()) {
script_ext_hint += ",";
}
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index c694d6b8e0..6ba5ad4fd6 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -538,7 +538,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
Engine::get_singleton()->get_singletons(&names);
property.hint = PROPERTY_HINT_ENUM;
String sl;
- for (Engine::Singleton &E : names) {
+ for (const Engine::Singleton &E : names) {
if (sl != String()) {
sl += ",";
}
@@ -683,7 +683,7 @@ void VisualScriptFunctionCall::_bind_methods() {
}
String script_ext_hint;
- for (String &E : script_extensions) {
+ for (const String &E : script_extensions) {
if (script_ext_hint != String()) {
script_ext_hint += ",";
}
@@ -1004,7 +1004,7 @@ PropertyInfo VisualScriptPropertySet::get_input_value_port_info(int p_idx) const
List<PropertyInfo> props;
ClassDB::get_property_list(_get_base_type(), &props, false);
- for (PropertyInfo &E : props) {
+ for (const PropertyInfo &E : props) {
if (E.name == property) {
String detail_prop_name = property;
if (index != StringName()) {
@@ -1135,7 +1135,7 @@ void VisualScriptPropertySet::_update_cache() {
List<PropertyInfo> pinfo;
v.get_property_list(&pinfo);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
if (E.name == property) {
type_cache = E;
}
@@ -1186,7 +1186,7 @@ void VisualScriptPropertySet::_update_cache() {
script->get_script_property_list(&pinfo);
}
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
if (E.name == property) {
type_cache = E;
return;
@@ -1354,7 +1354,7 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const {
List<PropertyInfo> plist;
v.get_property_list(&plist);
String options = "";
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
options += "," + E.name;
}
@@ -1410,7 +1410,7 @@ void VisualScriptPropertySet::_bind_methods() {
}
String script_ext_hint;
- for (String &E : script_extensions) {
+ for (const String &E : script_extensions) {
if (script_ext_hint != String()) {
script_ext_hint += ",";
}
@@ -1820,7 +1820,7 @@ void VisualScriptPropertyGet::_update_cache() {
List<PropertyInfo> pinfo;
v.get_property_list(&pinfo);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
if (E.name == property) {
type_cache = E.type;
return;
@@ -2059,7 +2059,7 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const {
List<PropertyInfo> plist;
v.get_property_list(&plist);
String options = "";
- for (PropertyInfo &E : plist) {
+ for (const PropertyInfo &E : plist) {
options += "," + E.name;
}
@@ -2112,7 +2112,7 @@ void VisualScriptPropertyGet::_bind_methods() {
}
String script_ext_hint;
- for (String &E : script_extensions) {
+ for (const String &E : script_extensions) {
if (script_ext_hint != String()) {
script_ext_hint += ",";
}
@@ -2323,7 +2323,7 @@ void VisualScriptEmitSignal::_validate_property(PropertyInfo &property) const {
}
String ml;
- for (StringName &E : sigs) {
+ for (const StringName &E : sigs) {
if (ml != String()) {
ml += ",";
}
@@ -2418,7 +2418,7 @@ void register_visual_script_func_nodes() {
List<MethodInfo> ml;
vt.get_method_list(&ml);
- for (MethodInfo &E : ml) {
+ for (const MethodInfo &E : ml) {
VisualScriptLanguage::singleton->add_register_func("functions/by_type/" + type_name + "/" + E.name, create_basic_type_call_node);
}
}
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index e6511792aa..c517d89aa5 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -1306,7 +1306,7 @@ void VisualScriptVariableGet::_validate_property(PropertyInfo &property) const {
vs->get_variable_list(&vars);
String vhint;
- for (StringName &E : vars) {
+ for (const StringName &E : vars) {
if (vhint != String()) {
vhint += ",";
}
@@ -1416,7 +1416,7 @@ void VisualScriptVariableSet::_validate_property(PropertyInfo &property) const {
vs->get_variable_list(&vars);
String vhint;
- for (StringName &E : vars) {
+ for (const StringName &E : vars) {
if (vhint != String()) {
vhint += ",";
}
@@ -1944,7 +1944,7 @@ void VisualScriptClassConstant::set_base_type(const StringName &p_which) {
ClassDB::get_integer_constant_list(base_type, &constants, true);
if (constants.size() > 0) {
bool found_name = false;
- for (String &E : constants) {
+ for (const String &E : constants) {
if (E == name) {
found_name = true;
break;
@@ -1993,7 +1993,7 @@ void VisualScriptClassConstant::_validate_property(PropertyInfo &property) const
ClassDB::get_integer_constant_list(base_type, &constants, true);
property.hint_string = "";
- for (String &E : constants) {
+ for (const String &E : constants) {
if (property.hint_string != String()) {
property.hint_string += ",";
}
@@ -2078,7 +2078,7 @@ void VisualScriptBasicTypeConstant::set_basic_type(Variant::Type p_which) {
Variant::get_constants_for_type(type, &constants);
if (constants.size() > 0) {
bool found_name = false;
- for (StringName &E : constants) {
+ for (const StringName &E : constants) {
if (E == name) {
found_name = true;
break;
@@ -2131,7 +2131,7 @@ void VisualScriptBasicTypeConstant::_validate_property(PropertyInfo &property) c
return;
}
property.hint_string = "";
- for (StringName &E : constants) {
+ for (const StringName &E : constants) {
if (property.hint_string != String()) {
property.hint_string += ",";
}
@@ -2358,7 +2358,7 @@ void VisualScriptEngineSingleton::_validate_property(PropertyInfo &property) con
Engine::get_singleton()->get_singletons(&singletons);
- for (Engine::Singleton &E : singletons) {
+ for (const Engine::Singleton &E : singletons) {
if (E.name == "VS" || E.name == "PS" || E.name == "PS2D" || E.name == "AS" || E.name == "TS" || E.name == "SS" || E.name == "SS2D") {
continue; //skip these, too simple named
}
@@ -3749,7 +3749,7 @@ void VisualScriptInputAction::_validate_property(PropertyInfo &property) const {
ProjectSettings::get_singleton()->get_property_list(&pinfo);
Vector<String> al;
- for (PropertyInfo &pi : pinfo) {
+ for (const PropertyInfo &pi : pinfo) {
if (!pi.name.begins_with("input/")) {
continue;
}
@@ -3842,7 +3842,7 @@ void VisualScriptDeconstruct::_update_elements() {
List<PropertyInfo> pinfo;
v.get_property_list(&pinfo);
- for (PropertyInfo &E : pinfo) {
+ for (const PropertyInfo &E : pinfo) {
Element e;
e.name = E.name;
e.type = E.type;
@@ -4023,7 +4023,7 @@ void register_visual_script_nodes() {
List<MethodInfo> constructors;
Variant::get_constructor_list(Variant::Type(i), &constructors);
- for (MethodInfo &E : constructors) {
+ for (const MethodInfo &E : constructors) {
if (E.arguments.size() > 0) {
String name = "functions/constructors/" + Variant::get_type_name(Variant::Type(i)) + "(";
for (int j = 0; j < E.arguments.size(); j++) {
diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp
index 5e9ecbe615..8bf1c6cbfa 100644
--- a/modules/visual_script/visual_script_property_selector.cpp
+++ b/modules/visual_script/visual_script_property_selector.cpp
@@ -93,7 +93,7 @@ void VisualScriptPropertySelector::_update_search() {
base = ClassDB::get_parent_class_nocheck(base);
}
- for (StringName &E : base_list) {
+ for (const StringName &E : base_list) {
List<MethodInfo> methods;
List<PropertyInfo> props;
TreeItem *category = nullptr;
@@ -157,7 +157,7 @@ void VisualScriptPropertySelector::_update_search() {
ClassDB::get_property_list(E, &props, true);
}
}
- for (PropertyInfo &F : props) {
+ for (const PropertyInfo &F : props) {
if (!(F.usage & PROPERTY_USAGE_EDITOR) && !(F.usage & PROPERTY_USAGE_SCRIPT_VARIABLE)) {
continue;
}
@@ -340,7 +340,7 @@ void VisualScriptPropertySelector::get_visual_node_names(const String &root_filt
List<String> fnodes;
VisualScriptLanguage::singleton->get_registered_node_names(&fnodes);
- for (String &E : fnodes) {
+ for (const String &E : fnodes) {
if (!E.begins_with(root_filter)) {
continue;
}
diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp
index bf269b1d7a..9fa49b8a1d 100644
--- a/modules/visual_script/visual_script_yield_nodes.cpp
+++ b/modules/visual_script/visual_script_yield_nodes.cpp
@@ -438,7 +438,7 @@ void VisualScriptYieldSignal::_validate_property(PropertyInfo &property) const {
ClassDB::get_signal_list(_get_base_type(), &methods);
List<String> mstring;
- for (MethodInfo &E : methods) {
+ for (const MethodInfo &E : methods) {
if (E.name.begins_with("_")) {
continue;
}
@@ -448,7 +448,7 @@ void VisualScriptYieldSignal::_validate_property(PropertyInfo &property) const {
mstring.sort();
String ml;
- for (String &E : mstring) {
+ for (const String &E : mstring) {
if (ml != String()) {
ml += ",";
}