diff options
author | George Marques <george@gmarqu.es> | 2021-09-29 11:23:16 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2021-09-29 11:23:16 -0300 |
commit | 72c07708e82c3594172083c567e949cc5d9d5e27 (patch) | |
tree | 998bc165b051c8c3f76c68cb08cd6c94d7b40335 /modules/gdscript/gdscript_analyzer.cpp | |
parent | 5e609d0e8cecedc68d842fd9f1171d74c4584028 (diff) | |
download | redot-engine-72c07708e82c3594172083c567e949cc5d9d5e27.tar.gz |
GDScript: Don't allow builtin type names as identifiers
Diffstat (limited to 'modules/gdscript/gdscript_analyzer.cpp')
-rw-r--r-- | modules/gdscript/gdscript_analyzer.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 23e88ae059..aa62ad20ff 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -175,6 +175,11 @@ Error GDScriptAnalyzer::check_native_member_name_conflict(const StringName &p_me return ERR_PARSE_ERROR; } + if (GDScriptParser::get_builtin_type(p_member_name) != Variant::VARIANT_MAX) { + push_error(vformat(R"(The member "%s" cannot have the same name as a builtin type.)", p_member_name), p_member_node); + return ERR_PARSE_ERROR; + } + return OK; } |