Merge pull request #115461 from HolonProduction/gdscript/noroutine

GDScript: Prevent function states from leaking into typed temporaries, when overwriting with coroutines
This commit is contained in:
Thaddeus Crews
2026-06-18 15:14:14 -05:00
3 changed files with 33 additions and 2 deletions
+5 -2
View File
@@ -603,12 +603,15 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
case GDScriptParser::Node::CALL: {
const GDScriptParser::CallNode *call = static_cast<const GDScriptParser::CallNode *>(p_expression);
bool is_awaited = p_expression == awaited_node;
GDScriptDataType type = _gdtype_from_datatype(call->get_datatype(), codegen.script);
GDScriptCodeGenerator::Address result;
if (p_root) {
result = GDScriptCodeGenerator::Address(GDScriptCodeGenerator::Address::NIL);
} else if (is_awaited) {
// When called with await, we need to use an untyped temporary regardless of whether the base
// class function is a coroutine, because an inherited class could return a function state object.
result = codegen.add_temporary();
} else {
result = codegen.add_temporary(type);
result = codegen.add_temporary(_gdtype_from_datatype(call->get_datatype(), codegen.script));
}
Vector<GDScriptCodeGenerator::Address> arguments;