Use get_slicec instead of get_slice for single character splitters

This commit is contained in:
A Thousand Ships 2024-11-16 17:16:07 +01:00
parent b5bdb88062
commit 466590d0ec
No known key found for this signature in database
GPG key ID: DEFC5A5B1306947D
58 changed files with 210 additions and 210 deletions

View file

@ -530,9 +530,9 @@ String GDScriptLanguage::make_function(const String &p_class, const String &p_na
if (i > 0) {
s += ", ";
}
s += p_args[i].get_slice(":", 0);
s += p_args[i].get_slicec(':', 0);
if (th) {
String type = p_args[i].get_slice(":", 1);
String type = p_args[i].get_slicec(':', 1);
if (!type.is_empty()) {
s += ": " + type;
}
@ -722,8 +722,8 @@ static String _get_visual_datatype(const PropertyInfo &p_info, bool p_is_arg, co
} else if (p_info.type == Variant::ARRAY && p_info.hint == PROPERTY_HINT_ARRAY_TYPE && !p_info.hint_string.is_empty()) {
return "Array[" + _trim_parent_class(p_info.hint_string, p_base_class) + "]";
} else if (p_info.type == Variant::DICTIONARY && p_info.hint == PROPERTY_HINT_DICTIONARY_TYPE && !p_info.hint_string.is_empty()) {
const String key = p_info.hint_string.get_slice(";", 0);
const String value = p_info.hint_string.get_slice(";", 1);
const String key = p_info.hint_string.get_slicec(';', 0);
const String value = p_info.hint_string.get_slicec(';', 1);
return "Dictionary[" + _trim_parent_class(key, p_base_class) + ", " + _trim_parent_class(value, p_base_class) + "]";
} else if (p_info.type == Variant::NIL) {
if (p_is_arg || (p_info.usage & PROPERTY_USAGE_NIL_IS_VARIANT)) {
@ -1866,7 +1866,7 @@ static bool _guess_expression_type(GDScriptParser::CompletionContext &p_context,
if (all_is_const && call->function_name == SNAME("get_node") && ClassDB::is_parent_class(native_type.native_type, SNAME("Node")) && args.size()) {
String arg1 = args[0];
if (arg1.begins_with("/root/")) {
String which = arg1.get_slice("/", 2);
String which = arg1.get_slicec('/', 2);
if (!which.is_empty()) {
// Try singletons first
if (GDScriptLanguage::get_singleton()->get_named_globals_map().has(which)) {
@ -2745,8 +2745,8 @@ static void _find_enumeration_candidates(GDScriptParser::CompletionContext &p_co
}
}
} else {
String class_name = p_enum_hint.get_slice(".", 0);
String enum_name = p_enum_hint.get_slice(".", 1);
String class_name = p_enum_hint.get_slicec('.', 0);
String enum_name = p_enum_hint.get_slicec('.', 1);
if (!ClassDB::class_exists(class_name)) {
return;
@ -2949,7 +2949,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
if (!s.begins_with("autoload/")) {
continue;
}
String name = s.get_slice("/", 1);
String name = s.get_slicec('/', 1);
String path = ("/root/" + name).quote(quote_style);
if (use_node_paths) {
path = "^" + path;
@ -2968,7 +2968,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
if (!s.begins_with("input/")) {
continue;
}
String name = s.get_slice("/", 1).quote(quote_style);
String name = s.get_slicec('/', 1).quote(quote_style);
if (use_string_names) {
name = "&" + name;
}
@ -3491,7 +3491,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
for (const MethodInfo &mi : virtual_methods) {
String method_hint = mi.name;
if (method_hint.contains_char(':')) {
method_hint = method_hint.get_slice(":", 0);
method_hint = method_hint.get_slicec(':', 0);
}
method_hint += "(";