mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- versioned the return mismatch check to demote it to a warning for older versions than 3.7.
This commit is contained in:
parent
d3461be40c
commit
b9f2cce8de
2 changed files with 11 additions and 5 deletions
|
@ -10632,11 +10632,17 @@ FxExpression *FxReturnStatement::Resolve(FCompileContext &ctx)
|
|||
|
||||
if (ctx.ReturnProto != nullptr && ctx.ReturnProto->ReturnTypes.Size() != Args.Size())
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "Incorrect number of return values. Got %u, but expected %u", Args.Size(), ctx.ReturnProto->ReturnTypes.Size());
|
||||
int severity = ctx.Version >= MakeVersion(3, 7) ? MSG_ERROR : MSG_WARNING;
|
||||
ScriptPosition.Message(severity, "Incorrect number of return values. Got %u, but expected %u", Args.Size(), ctx.ReturnProto->ReturnTypes.Size());
|
||||
if (severity == MSG_ERROR)
|
||||
{
|
||||
delete this;
|
||||
return nullptr;
|
||||
}
|
||||
else if (Args.Size() == 0)
|
||||
// For older script versions this must fall through.
|
||||
}
|
||||
|
||||
if (Args.Size() == 0)
|
||||
{
|
||||
TArray<PType *> none(0);
|
||||
retproto = NewPrototype(none, none);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
version "3.4"
|
||||
version "3.7"
|
||||
#include "zscript/base.txt"
|
||||
#include "zscript/sounddata.txt"
|
||||
#include "zscript/mapdata.txt"
|
||||
|
|
Loading…
Reference in a new issue