mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Validate that C# class names are valid identifiers
(cherry picked from commit ae8752a731)
This commit is contained in:
parent
01324f025a
commit
782e1fe84e
1 changed files with 5 additions and 0 deletions
|
|
@ -57,6 +57,7 @@
|
||||||
#include "godotsharp_dirs.h"
|
#include "godotsharp_dirs.h"
|
||||||
#include "managed_callable.h"
|
#include "managed_callable.h"
|
||||||
#include "mono_gd/gd_mono_cache.h"
|
#include "mono_gd/gd_mono_cache.h"
|
||||||
|
#include "servers/text_server.h"
|
||||||
#include "signal_awaiter_utils.h"
|
#include "signal_awaiter_utils.h"
|
||||||
#include "utils/macros.h"
|
#include "utils/macros.h"
|
||||||
#include "utils/naming_utils.h"
|
#include "utils/naming_utils.h"
|
||||||
|
|
@ -366,6 +367,10 @@ String CSharpLanguage::validate_path(const String &p_path) const {
|
||||||
if (keywords.find(class_name)) {
|
if (keywords.find(class_name)) {
|
||||||
return RTR("Class name can't be a reserved keyword");
|
return RTR("Class name can't be a reserved keyword");
|
||||||
}
|
}
|
||||||
|
if (!TS->is_valid_identifier(class_name)) {
|
||||||
|
return RTR("Class name must be a valid identifier");
|
||||||
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue