From b9f2cce8de24b259c497bd94c34c885521f7a8de Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 1 Nov 2018 11:30:53 +0100 Subject: [PATCH] - versioned the return mismatch check to demote it to a warning for older versions than 3.7. --- src/scripting/backend/codegen.cpp | 14 ++++++++++---- wadsrc/static/zscript.txt | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index a8053badd0..0055c656bd 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -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()); - delete this; - return nullptr; + 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; + } + // For older script versions this must fall through. } - else if (Args.Size() == 0) + + if (Args.Size() == 0) { TArray none(0); retproto = NewPrototype(none, none); diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index 082b69532d..449bfe054c 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -1,4 +1,4 @@ -version "3.4" +version "3.7" #include "zscript/base.txt" #include "zscript/sounddata.txt" #include "zscript/mapdata.txt"