mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Add String.is_valid_unicode_identifier()
- Adds `is_valid_unicode_identifier()` - Adds `is_valid_ascii_identifier()` - Deprecates `is_valid_identifier()` - Renames `validate_identifier()` to `validate_ascii_identifier()`
This commit is contained in:
parent
db76de5de8
commit
8bf4ecc026
22 changed files with 132 additions and 60 deletions
|
@ -1816,9 +1816,9 @@ static String _get_dropped_resource_line(const Ref<Resource> &p_resource, bool p
|
|||
}
|
||||
|
||||
if (is_script) {
|
||||
variable_name = variable_name.to_pascal_case().validate_identifier();
|
||||
variable_name = variable_name.to_pascal_case().validate_ascii_identifier();
|
||||
} else {
|
||||
variable_name = variable_name.to_snake_case().to_upper().validate_identifier();
|
||||
variable_name = variable_name.to_snake_case().to_upper().validate_ascii_identifier();
|
||||
}
|
||||
return vformat("const %s = preload(%s)", variable_name, _quote_drop_data(path));
|
||||
}
|
||||
|
@ -1932,13 +1932,13 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
|
|||
path = sn->get_path_to(node);
|
||||
}
|
||||
for (const String &segment : path.split("/")) {
|
||||
if (!segment.is_valid_identifier()) {
|
||||
if (!segment.is_valid_ascii_identifier()) {
|
||||
path = _quote_drop_data(path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
String variable_name = String(node->get_name()).to_snake_case().validate_identifier();
|
||||
String variable_name = String(node->get_name()).to_snake_case().validate_ascii_identifier();
|
||||
if (use_type) {
|
||||
StringName class_name = node->get_class_name();
|
||||
Ref<Script> node_script = node->get_script();
|
||||
|
@ -1975,7 +1975,7 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
|
|||
}
|
||||
|
||||
for (const String &segment : path.split("/")) {
|
||||
if (!segment.is_valid_identifier()) {
|
||||
if (!segment.is_valid_ascii_identifier()) {
|
||||
path = _quote_drop_data(path);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue