1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Clarify error message about script-level annotation

This commit is contained in:
Danil Alexeev
2023-01-24 13:10:45 +03:00
parent 4fa6edc888
commit 13215638a9
2 changed files with 6 additions and 2 deletions

View File

@@ -1434,7 +1434,11 @@ GDScriptParser::AnnotationNode *GDScriptParser::parse_annotation(uint32_t p_vali
annotation->info = &valid_annotations[annotation->name];
if (!annotation->applies_to(p_valid_targets)) {
push_error(vformat(R"(Annotation "%s" is not allowed in this level.)", annotation->name));
if (annotation->applies_to(AnnotationInfo::SCRIPT)) {
push_error(vformat(R"(Annotation "%s" must be at the top of the script, before "extends" and "class_name".)", annotation->name));
} else {
push_error(vformat(R"(Annotation "%s" is not allowed in this level.)", annotation->name));
}
valid = false;
}