GDScript: Fix compiler generates incorrect bytecode for conversion return
This commit is contained in:
@@ -2168,10 +2168,10 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Sui
|
||||
}
|
||||
|
||||
if (return_n->void_return) {
|
||||
// Always return "null", even if the expression is a call to a void function.
|
||||
gen->write_return(codegen.add_constant(Variant()));
|
||||
// Always return `null`, even if the expression is a call to a `void` function.
|
||||
gen->write_return(codegen.add_constant(Variant()), false);
|
||||
} else {
|
||||
gen->write_return(return_value);
|
||||
gen->write_return(return_value, return_n->use_conversion);
|
||||
}
|
||||
if (return_value.mode == GDScriptCodeGenerator::Address::TEMPORARY) {
|
||||
codegen.generator->pop_temporary();
|
||||
|
||||
Reference in New Issue
Block a user