Merge pull request #110952 from aaronfranke/skip-cons-then-copy

Skip copying values constructed immediately before returning
This commit is contained in:
Thaddeus Crews
2025-09-30 11:19:15 -05:00
14 changed files with 35 additions and 60 deletions

View File

@ -265,7 +265,7 @@ void ENetConnection::get_peers(List<Ref<ENetPacketPeer>> &r_peers) {
}
TypedArray<ENetPacketPeer> ENetConnection::_get_peers() {
ERR_FAIL_NULL_V_MSG(host, Array(), "The ENetConnection instance isn't currently active.");
ERR_FAIL_NULL_V_MSG(host, TypedArray<ENetPacketPeer>(), "The ENetConnection instance isn't currently active.");
TypedArray<ENetPacketPeer> out;
for (const Ref<ENetPacketPeer> &I : peers) {
out.push_back(I);

View File

@ -885,8 +885,8 @@ const Array &ExtendGDScriptParser::get_member_completions() {
}
Dictionary ExtendGDScriptParser::dump_function_api(const GDScriptParser::FunctionNode *p_func) const {
ERR_FAIL_NULL_V(p_func, Dictionary());
Dictionary func;
ERR_FAIL_NULL_V(p_func, func);
func["name"] = p_func->identifier->name;
func["return_type"] = p_func->get_datatype().to_string();
func["rpc_config"] = p_func->rpc_config;
@ -909,10 +909,9 @@ Dictionary ExtendGDScriptParser::dump_function_api(const GDScriptParser::Functio
}
Dictionary ExtendGDScriptParser::dump_class_api(const GDScriptParser::ClassNode *p_class) const {
ERR_FAIL_NULL_V(p_class, Dictionary());
Dictionary class_api;
ERR_FAIL_NULL_V(p_class, class_api);
class_api["name"] = p_class->identifier != nullptr ? String(p_class->identifier->name) : String();
class_api["path"] = path;
Array extends_class;

View File

@ -355,13 +355,11 @@ Dictionary GDScriptTextDocument::resolve(const Dictionary &p_params) {
}
Array GDScriptTextDocument::foldingRange(const Dictionary &p_params) {
Array arr;
return arr;
return Array();
}
Array GDScriptTextDocument::codeLens(const Dictionary &p_params) {
Array arr;
return arr;
return Array();
}
Array GDScriptTextDocument::documentLink(const Dictionary &p_params) {
@ -379,8 +377,7 @@ Array GDScriptTextDocument::documentLink(const Dictionary &p_params) {
}
Array GDScriptTextDocument::colorPresentation(const Dictionary &p_params) {
Array arr;
return arr;
return Array();
}
Variant GDScriptTextDocument::hover(const Dictionary &p_params) {
@ -416,8 +413,7 @@ Array GDScriptTextDocument::definition(const Dictionary &p_params) {
LSP::TextDocumentPositionParams params;
params.load(p_params);
List<const LSP::DocumentSymbol *> symbols;
Array arr = find_symbols(params, symbols);
return arr;
return find_symbols(params, symbols);
}
Variant GDScriptTextDocument::declaration(const Dictionary &p_params) {

View File

@ -575,8 +575,7 @@ struct SaveOptions {
*/
struct ColorProviderOptions {
Dictionary to_json() {
Dictionary dict;
return dict;
return Dictionary();
}
};
@ -585,8 +584,7 @@ struct ColorProviderOptions {
*/
struct FoldingRangeProviderOptions {
Dictionary to_json() {
Dictionary dict;
return dict;
return Dictionary();
}
};

View File

@ -271,7 +271,7 @@ Ref<RegExMatch> RegEx::search(const String &p_subject, int p_offset, int p_end)
}
TypedArray<RegExMatch> RegEx::search_all(const String &p_subject, int p_offset, int p_end) const {
ERR_FAIL_COND_V_MSG(p_offset < 0, Array(), "RegEx search offset must be >= 0");
ERR_FAIL_COND_V_MSG(p_offset < 0, TypedArray<RegExMatch>(), "RegEx search offset must be >= 0");
int last_end = 0;
TypedArray<RegExMatch> result;