Merge pull request #93517 from Repiteo/core/nodiscard-strings

Core: Add `[[nodiscard]]` to string-like classes/structs
This commit is contained in:
Thaddeus Crews
2025-05-07 12:48:27 -05:00
12 changed files with 22 additions and 21 deletions

View File

@@ -2854,7 +2854,8 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b
if (subclass->extends_used) {
if (!subclass->extends_path.is_empty()) {
if (subclass->extends.is_empty()) {
get_global_class_name(subclass->extends_path, r_base_type);
// We only care about the referenced class_name.
_ALLOW_DISCARD_ get_global_class_name(subclass->extends_path, r_base_type);
subclass = nullptr;
break;
} else {

View File

@@ -489,7 +489,8 @@ bool GDScriptWorkspace::can_rename(const LSP::TextDocumentPositionParams &p_doc_
String path = get_file_path(p_doc_pos.textDocument.uri);
if (const ExtendGDScriptParser *parser = get_parse_result(path)) {
parser->get_identifier_under_position(p_doc_pos.position, r_range);
// We only care about the range.
_ALLOW_DISCARD_ parser->get_identifier_under_position(p_doc_pos.position, r_range);
r_symbol = *reference_symbol;
return true;
}
@@ -847,9 +848,7 @@ Error GDScriptWorkspace::resolve_signature(const LSP::TextDocumentPositionParams
return ERR_METHOD_NOT_FOUND;
}
GDScriptWorkspace::GDScriptWorkspace() {
ProjectSettings::get_singleton()->get_resource_path();
}
GDScriptWorkspace::GDScriptWorkspace() {}
GDScriptWorkspace::~GDScriptWorkspace() {
HashSet<String> cached_parsers;