mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
GDScript: Allow void functions to return calls to other void functions
This commit is contained in:
parent
e1648b3327
commit
a47d4d57ca
8 changed files with 78 additions and 10 deletions
|
@ -1859,7 +1859,12 @@ Error GDScriptCompiler::_parse_block(CodeGen &codegen, const GDScriptParser::Sui
|
|||
}
|
||||
}
|
||||
|
||||
gen->write_return(return_value);
|
||||
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()));
|
||||
} else {
|
||||
gen->write_return(return_value);
|
||||
}
|
||||
if (return_value.mode == GDScriptCodeGenerator::Address::TEMPORARY) {
|
||||
codegen.generator->pop_temporary();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue