mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-13 07:57:51 +00:00
- fixed: The return prototyxpe may only be retrieved after the return state of the function has been checked. Also made this a real error message instead of an assert because it will inevitably result in a crash if the prototype cannot be generated, making diagnostics impossible.
This commit is contained in:
parent
0f9ebff3ee
commit
b59f4e950f
1 changed files with 7 additions and 3 deletions
|
@ -715,13 +715,10 @@ void FFunctionBuildList::Build()
|
||||||
|
|
||||||
FScriptPosition::StrictErrors = !item.FromDecorate;
|
FScriptPosition::StrictErrors = !item.FromDecorate;
|
||||||
item.Code = item.Code->Resolve(ctx);
|
item.Code = item.Code->Resolve(ctx);
|
||||||
item.Proto = ctx.ReturnProto;
|
|
||||||
|
|
||||||
// Make sure resolving it didn't obliterate it.
|
// Make sure resolving it didn't obliterate it.
|
||||||
if (item.Code != nullptr)
|
if (item.Code != nullptr)
|
||||||
{
|
{
|
||||||
assert(item.Proto != nullptr);
|
|
||||||
|
|
||||||
if (!item.Code->CheckReturn())
|
if (!item.Code->CheckReturn())
|
||||||
{
|
{
|
||||||
auto newcmpd = new FxCompoundStatement(item.Code->ScriptPosition);
|
auto newcmpd = new FxCompoundStatement(item.Code->ScriptPosition);
|
||||||
|
@ -730,6 +727,13 @@ void FFunctionBuildList::Build()
|
||||||
item.Code = newcmpd->Resolve(ctx);
|
item.Code = newcmpd->Resolve(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
item.Proto = ctx.ReturnProto;
|
||||||
|
if (item.Proto == nullptr)
|
||||||
|
{
|
||||||
|
item.Code->ScriptPosition.Message(MSG_ERROR, "Function %s without prototype", item.PrintableName.GetChars());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// 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