Fix mistakes in documentation and GDScript errors

This commit is contained in:
VolTer
2023-04-06 08:04:22 +02:00
parent e11ae937d5
commit f832eb92e4
6 changed files with 14 additions and 15 deletions

View File

@@ -1343,7 +1343,7 @@ void GDScriptParser::parse_function_signature(FunctionNode *p_function, SuiteNod
default_used = true;
} else {
if (default_used) {
push_error("Cannot have a mandatory parameters after optional parameters.");
push_error("Cannot have mandatory parameters after optional parameters.");
continue;
}
}
@@ -1475,7 +1475,7 @@ GDScriptParser::AnnotationNode *GDScriptParser::parse_annotation(uint32_t p_vali
void GDScriptParser::clear_unused_annotations() {
for (const AnnotationNode *annotation : annotation_stack) {
push_error(vformat(R"(Annotation "%s" does not precedes a valid target, so it will have no effect.)", annotation->name), annotation);
push_error(vformat(R"(Annotation "%s" does not precede a valid target, so it will have no effect.)", annotation->name), annotation);
}
annotation_stack.clear();
@@ -1817,7 +1817,7 @@ GDScriptParser::ForNode *GDScriptParser::parse_for() {
n_for->list = parse_expression(false);
if (!n_for->list) {
push_error(R"(Expected a list or range after "in".)");
push_error(R"(Expected iterable after "in".)");
}
consume(GDScriptTokenizer::Token::COLON, R"(Expected ":" after "for" condition.)");
@@ -3856,7 +3856,7 @@ bool GDScriptParser::export_annotations(const AnnotationNode *p_annotation, Node
variable->export_info.hint = PROPERTY_HINT_NODE_TYPE;
variable->export_info.hint_string = export_type.to_string();
} else {
push_error(R"(Export type can only be built-in, a resource, a node or an enum.)", variable);
push_error(R"(Export type can only be built-in, a resource, a node, or an enum.)", variable);
return false;
}
@@ -3901,8 +3901,7 @@ bool GDScriptParser::export_annotations(const AnnotationNode *p_annotation, Node
variable->export_info.hint_string = enum_hint_string;
} break;
default:
// TODO: Allow custom user resources.
push_error(R"(Export type can only be built-in, a resource, or an enum.)", variable);
push_error(R"(Export type can only be built-in, a resource, a node, or an enum.)", variable);
break;
}

View File

@@ -183,7 +183,7 @@ String GDScriptWarning::get_message() const {
return vformat(R"*(The default value is using "%s" which won't return nodes in the scene tree before "_ready()" is called. Use the "@onready" annotation to solve this.)*", symbols[0]);
}
case ONREADY_WITH_EXPORT: {
return R"(The "@onready" annotation will make the default value to be set after the "@export" takes effect and will override it.)";
return R"("@onready" will set the default value after "@export" takes effect and will override it.)";
}
case WARNING_MAX:
break; // Can't happen, but silences warning

View File

@@ -2,5 +2,5 @@ GDTEST_OK
>> WARNING
>> Line: 3
>> ONREADY_WITH_EXPORT
>> The "@onready" annotation will make the default value to be set after the "@export" takes effect and will override it.
>> "@onready" will set the default value after "@export" takes effect and will override it.
warn