GDScript: Don't allow built-in scripts to use class_name

(cherry picked from commit e56f5d5c91)
This commit is contained in:
George Marques 2019-04-10 18:05:34 -03:00 committed by Hein-Pieter van Braam-Stewart
parent 667dc0b336
commit 42514bfd80
1 changed files with 4 additions and 0 deletions

View File

@ -3494,6 +3494,10 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
_set_error("'class_name' is only valid for the main class namespace.");
return;
}
if (self_path.empty()) {
_set_error("'class_name' not allowed in built-in scripts.");
return;
}
if (tokenizer->get_token(1) != GDScriptTokenizer::TK_IDENTIFIER) {
_set_error("'class_name' syntax: 'class_name <UniqueName>'");