GDScript: Prevent function states from leaking into typed temporaries, when overwriting with coroutines
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user