diff options
Diffstat (limited to 'modules/mono')
-rw-r--r-- | modules/mono/csharp_script.cpp | 2 | ||||
-rw-r--r-- | modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs | 21 | ||||
-rw-r--r-- | modules/mono/editor/bindings_generator.cpp | 24 | ||||
-rw-r--r-- | modules/mono/editor/code_completion.cpp | 2 | ||||
-rw-r--r-- | modules/mono/utils/path_utils.cpp | 2 |
5 files changed, 18 insertions, 33 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index adcf1b79b8..937048d000 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -2819,7 +2819,7 @@ Ref<Resource> ResourceFormatLoaderCSharpScript::load(const String &p_path, const if (p_path.begins_with("csharp://")) { // This is a virtual path used by generic types, extract the real path. real_path = "res://" + p_path.trim_prefix("csharp://"); - real_path = real_path.substr(0, real_path.rfind(":")); + real_path = real_path.substr(0, real_path.rfind_char(':')); } Ref<CSharpScript> scr; diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs index e8f46c7a11..cc80c03c74 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs @@ -423,25 +423,10 @@ namespace Godot.SourceGenerators if (exportAttr != null && propertySymbol != null) { - if (propertySymbol.GetMethod == null) + if (propertySymbol.GetMethod == null || propertySymbol.SetMethod == null || propertySymbol.SetMethod.IsInitOnly) { - // This should never happen, as we filtered WriteOnly properties, but just in case. - context.ReportDiagnostic(Diagnostic.Create( - Common.ExportedPropertyIsWriteOnlyRule, - propertySymbol.Locations.FirstLocationWithSourceTreeOrDefault(), - propertySymbol.ToDisplayString() - )); - return null; - } - - if (propertySymbol.SetMethod == null || propertySymbol.SetMethod.IsInitOnly) - { - // This should never happen, as we filtered ReadOnly properties, but just in case. - context.ReportDiagnostic(Diagnostic.Create( - Common.ExportedMemberIsReadOnlyRule, - propertySymbol.Locations.FirstLocationWithSourceTreeOrDefault(), - propertySymbol.ToDisplayString() - )); + // Exports can be neither read-only nor write-only but the diagnostic errors for properties are already + // reported by ScriptPropertyDefValGenerator.cs so just quit early here. return null; } } diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 400ff0a3b8..efe03298b9 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -192,7 +192,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter int pos = 0; while (pos < bbcode.length()) { - int brk_pos = bbcode.find("[", pos); + int brk_pos = bbcode.find_char('[', pos); if (brk_pos < 0) { brk_pos = bbcode.length(); @@ -212,7 +212,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter break; } - int brk_end = bbcode.find("]", brk_pos + 1); + int brk_end = bbcode.find_char(']', brk_pos + 1); if (brk_end == -1) { String text = bbcode.substr(brk_pos, bbcode.length() - brk_pos); @@ -241,7 +241,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter output.append("["); pos = brk_pos + 1; } else if (tag.begins_with("method ") || tag.begins_with("constructor ") || tag.begins_with("operator ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ") || tag.begins_with("constant ") || tag.begins_with("theme_item ") || tag.begins_with("param ")) { - const int tag_end = tag.find(" "); + const int tag_end = tag.find_char(' '); const String link_tag = tag.substr(0, tag_end); const String link_target = tag.substr(tag_end + 1, tag.length()).lstrip(" "); @@ -387,7 +387,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter pos = brk_end + 1; tag_stack.push_front(tag); } else if (tag == "url") { - int end = bbcode.find("[", brk_end); + int end = bbcode.find_char('[', brk_end); if (end == -1) { end = bbcode.length(); } @@ -405,7 +405,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter pos = brk_end + 1; tag_stack.push_front("url"); } else if (tag == "img") { - int end = bbcode.find("[", brk_end); + int end = bbcode.find_char('[', brk_end); if (end == -1) { end = bbcode.length(); } @@ -457,7 +457,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf int pos = 0; while (pos < bbcode.length()) { - int brk_pos = bbcode.find("[", pos); + int brk_pos = bbcode.find_char('[', pos); if (brk_pos < 0) { brk_pos = bbcode.length(); @@ -490,7 +490,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf break; } - int brk_end = bbcode.find("]", brk_pos + 1); + int brk_end = bbcode.find_char(']', brk_pos + 1); if (brk_end == -1) { if (!line_del) { @@ -553,7 +553,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf xml_output.append("["); pos = brk_pos + 1; } else if (tag.begins_with("method ") || tag.begins_with("constructor ") || tag.begins_with("operator ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ") || tag.begins_with("constant ") || tag.begins_with("theme_item ") || tag.begins_with("param ")) { - const int tag_end = tag.find(" "); + const int tag_end = tag.find_char(' '); const String link_tag = tag.substr(0, tag_end); const String link_target = tag.substr(tag_end + 1, tag.length()).lstrip(" "); @@ -698,7 +698,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf pos = brk_end + 1; tag_stack.push_front(tag); } else if (tag == "code" || tag.begins_with("code ")) { - int end = bbcode.find("[", brk_end); + int end = bbcode.find_char('[', brk_end); if (end == -1) { end = bbcode.length(); } @@ -753,7 +753,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf pos = brk_end + 1; tag_stack.push_front(tag); } else if (tag == "url") { - int end = bbcode.find("[", brk_end); + int end = bbcode.find_char('[', brk_end); if (end == -1) { end = bbcode.length(); } @@ -774,7 +774,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf pos = brk_end + 1; tag_stack.push_front("url"); } else if (tag == "img") { - int end = bbcode.find("[", brk_end); + int end = bbcode.find_char('[', brk_end); if (end == -1) { end = bbcode.length(); } @@ -1621,7 +1621,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) { bool enum_in_static_class = false; - if (enum_proxy_name.find(".") > 0) { + if (enum_proxy_name.find_char('.') > 0) { enum_in_static_class = true; String enum_class_name = enum_proxy_name.get_slicec('.', 0); enum_proxy_name = enum_proxy_name.get_slicec('.', 1); diff --git a/modules/mono/editor/code_completion.cpp b/modules/mono/editor/code_completion.cpp index bc3779d23d..b52daa0210 100644 --- a/modules/mono/editor/code_completion.cpp +++ b/modules/mono/editor/code_completion.cpp @@ -118,7 +118,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr continue; } - String name = prop.name.substr(prop.name.find("/") + 1, prop.name.length()); + String name = prop.name.substr(prop.name.find_char('/') + 1, prop.name.length()); suggestions.push_back(quoted(name)); } } break; diff --git a/modules/mono/utils/path_utils.cpp b/modules/mono/utils/path_utils.cpp index ba394d7d00..e3488a5ec0 100644 --- a/modules/mono/utils/path_utils.cpp +++ b/modules/mono/utils/path_utils.cpp @@ -214,7 +214,7 @@ String relative_to_impl(const String &p_path, const String &p_relative_to) { #ifdef WINDOWS_ENABLED String get_drive_letter(const String &p_norm_path) { int idx = p_norm_path.find(":/"); - if (idx != -1 && idx < p_norm_path.find("/")) { + if (idx != -1 && idx < p_norm_path.find_char('/')) { return p_norm_path.substr(0, idx + 1); } return String(); |