mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-13 07:57:58 +00:00
- fixed: The return checking code must be inside the nullptr check for item.code.
This commit is contained in:
parent
0851d698de
commit
0f9ebff3ee
1 changed files with 8 additions and 7 deletions
|
@ -715,13 +715,6 @@ void FFunctionBuildList::Build()
|
||||||
|
|
||||||
FScriptPosition::StrictErrors = !item.FromDecorate;
|
FScriptPosition::StrictErrors = !item.FromDecorate;
|
||||||
item.Code = item.Code->Resolve(ctx);
|
item.Code = item.Code->Resolve(ctx);
|
||||||
if (!item.Code->CheckReturn())
|
|
||||||
{
|
|
||||||
auto newcmpd = new FxCompoundStatement(item.Code->ScriptPosition);
|
|
||||||
newcmpd->Add(item.Code);
|
|
||||||
newcmpd->Add(new FxReturnStatement(nullptr, item.Code->ScriptPosition));
|
|
||||||
item.Code = newcmpd->Resolve(ctx);
|
|
||||||
}
|
|
||||||
item.Proto = ctx.ReturnProto;
|
item.Proto = ctx.ReturnProto;
|
||||||
|
|
||||||
// Make sure resolving it didn't obliterate it.
|
// Make sure resolving it didn't obliterate it.
|
||||||
|
@ -729,6 +722,14 @@ void FFunctionBuildList::Build()
|
||||||
{
|
{
|
||||||
assert(item.Proto != nullptr);
|
assert(item.Proto != nullptr);
|
||||||
|
|
||||||
|
if (!item.Code->CheckReturn())
|
||||||
|
{
|
||||||
|
auto newcmpd = new FxCompoundStatement(item.Code->ScriptPosition);
|
||||||
|
newcmpd->Add(item.Code);
|
||||||
|
newcmpd->Add(new FxReturnStatement(nullptr, item.Code->ScriptPosition));
|
||||||
|
item.Code = newcmpd->Resolve(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
// Generate prototype for anonymous functions.
|
// Generate prototype for anonymous functions.
|
||||||
VMScriptFunction *sfunc = item.Function;
|
VMScriptFunction *sfunc = item.Function;
|
||||||
// create a new prototype from the now known return type and the argument list of the function's template prototype.
|
// create a new prototype from the now known return type and the argument list of the function's template prototype.
|
||||||
|
|
Loading…
Reference in a new issue