summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_parser.cpp
diff options
context:
space:
mode:
authorDanil Alexeev <danil@alexeev.xyz>2023-01-24 13:10:45 +0300
committerDanil Alexeev <danil@alexeev.xyz>2023-01-24 13:10:45 +0300
commit13215638a99e5cf4014e4ec91e0e6a90b00c2dcf (patch)
treea53531725ebd2abd7a6cc4f5ba1b22c7744c2cec /modules/gdscript/gdscript_parser.cpp
parent4fa6edc888cfacd5346bf08afa14b5f5a9bd6d0c (diff)
downloadredot-engine-13215638a99e5cf4014e4ec91e0e6a90b00c2dcf.tar.gz
Clarify error message about script-level annotation
Diffstat (limited to 'modules/gdscript/gdscript_parser.cpp')
-rw-r--r--modules/gdscript/gdscript_parser.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 6dc63c502c..99b78a8326 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -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;
}