Fix synchronization of global class name

This commit is contained in:
Hilderin 2024-05-24 01:30:16 -04:00
parent 6b281c0c07
commit 39369db029
13 changed files with 455 additions and 201 deletions

View file

@ -309,13 +309,14 @@ void GDScriptParser::set_last_completion_call_arg(int p_argument) {
completion_call_stack.back()->get().argument = p_argument;
}
Error GDScriptParser::parse(const String &p_source_code, const String &p_script_path, bool p_for_completion) {
Error GDScriptParser::parse(const String &p_source_code, const String &p_script_path, bool p_for_completion, bool p_parse_body) {
clear();
String source = p_source_code;
int cursor_line = -1;
int cursor_column = -1;
for_completion = p_for_completion;
parse_body = p_parse_body;
int tab_size = 4;
#ifdef TOOLS_ENABLED
@ -689,6 +690,12 @@ void GDScriptParser::parse_program() {
}
}
// When the only thing needed is the class name and the icon, we don't need to parse the hole file.
// It really speed up the call to GDScriptLanguage::get_global_class_name especially for large script.
if (!parse_body) {
return;
}
#undef PUSH_PENDING_ANNOTATIONS_TO_HEAD
parse_class_body(true);