- versioned the return mismatch check to demote it to a warning for older versions than 3.7.

This commit is contained in:
Christoph Oelckers 2018-11-01 11:30:53 +01:00
parent d3461be40c
commit b9f2cce8de
2 changed files with 11 additions and 5 deletions

View file

@ -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);

View file

@ -1,4 +1,4 @@
version "3.4"
version "3.7"
#include "zscript/base.txt"
#include "zscript/sounddata.txt"
#include "zscript/mapdata.txt"