Validate that C# class names are valid identifiers

This commit is contained in:
Aleks Rutins 2023-03-03 18:25:15 -05:00
parent 61d2c85511
commit ae8752a731

View file

@ -58,6 +58,7 @@
#include "godotsharp_dirs.h"
#include "managed_callable.h"
#include "mono_gd/gd_mono_cache.h"
#include "servers/text_server.h"
#include "signal_awaiter_utils.h"
#include "utils/macros.h"
#include "utils/naming_utils.h"
@ -374,6 +375,10 @@ String CSharpLanguage::validate_path(const String &p_path) const {
if (keywords.find(class_name)) {
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 "";
}