mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Add errors for keywords removed in Godot 4
Update modules/gdscript/gdscript_parser.cpp Co-authored-by: Danil Alexeev <dalexeev12@yandex.ru> Improve error message Add tests Add errors for other removed keywords Remove very old keywords and improve wording of errors
This commit is contained in:
parent
28089c40c1
commit
5c662f7707
5 changed files with 35 additions and 1 deletions
|
@ -1087,7 +1087,27 @@ void GDScriptParser::parse_class_body(bool p_is_multiline) {
|
|||
// Display a completion with identifiers.
|
||||
make_completion_context(COMPLETION_IDENTIFIER, nullptr);
|
||||
advance();
|
||||
push_error(vformat(R"(Unexpected %s in class body.)", previous.get_debug_name()));
|
||||
if (previous.get_identifier() == "export") {
|
||||
push_error(R"(The "export" keyword was removed in Godot 4. Use an export annotation ("@export", "@export_range", etc.) instead.)");
|
||||
} else if (previous.get_identifier() == "tool") {
|
||||
push_error(R"(The "tool" keyword was removed in Godot 4. Use the "@tool" annotation instead.)");
|
||||
} else if (previous.get_identifier() == "onready") {
|
||||
push_error(R"(The "onready" keyword was removed in Godot 4. Use the "@onready" annotation instead.)");
|
||||
} else if (previous.get_identifier() == "remote") {
|
||||
push_error(R"(The "remote" keyword was removed in Godot 4. Use the "@rpc" annotation with "any_peer" instead.)");
|
||||
} else if (previous.get_identifier() == "remotesync") {
|
||||
push_error(R"(The "remotesync" keyword was removed in Godot 4. Use the "@rpc" annotation with "any_peer" and "call_local" instead.)");
|
||||
} else if (previous.get_identifier() == "puppet") {
|
||||
push_error(R"(The "puppet" keyword was removed in Godot 4. Use the "@rpc" annotation with "authority" instead.)");
|
||||
} else if (previous.get_identifier() == "puppetsync") {
|
||||
push_error(R"(The "puppetsync" keyword was removed in Godot 4. Use the "@rpc" annotation with "authority" and "call_local" instead.)");
|
||||
} else if (previous.get_identifier() == "master") {
|
||||
push_error(R"(The "master" keyword was removed in Godot 4. Use the "@rpc" annotation with "any_peer" and perform a check inside the function instead.)");
|
||||
} else if (previous.get_identifier() == "mastersync") {
|
||||
push_error(R"(The "mastersync" keyword was removed in Godot 4. Use the "@rpc" annotation with "any_peer" and "call_local", and perform a check inside the function instead.)");
|
||||
} else {
|
||||
push_error(vformat(R"(Unexpected %s in class body.)", previous.get_debug_name()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (token.type != GDScriptTokenizer::Token::STATIC) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue