diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 81f43f06b..8b75d7b62 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1247,7 +1247,6 @@ set (PCH_SOURCES scripting/thingdef_data.cpp scripting/thingdef_properties.cpp scripting/codegeneration/codegen.cpp - scripting/codegeneration/functioncalls.cpp scripting/decorate/olddecorations.cpp scripting/decorate/thingdef_exp.cpp scripting/decorate/thingdef_parse.cpp diff --git a/src/dobject.h b/src/dobject.h index 183d17dd2..3c4b23248 100644 --- a/src/dobject.h +++ b/src/dobject.h @@ -644,17 +644,14 @@ private: public: void Destroy() { - Printf("Destroy\n"); ExportedNatives::Get()->Destroy(this); } void Tick() { - Printf("Tick\n"); ExportedNatives::Get()->Tick(this); } AInventory *DropInventory(AInventory *item) { - Printf("DropInventory\n"); return ExportedNatives::Get()->DropInventory(this, item); } }; diff --git a/src/g_pch.h b/src/g_pch.h index 3f44cf9b5..a22649815 100644 --- a/src/g_pch.h +++ b/src/g_pch.h @@ -18,3 +18,4 @@ #include #include #include +#include diff --git a/src/scripting/codegeneration/functioncalls.cpp b/src/scripting/codegeneration/functioncalls.cpp deleted file mode 100644 index ca2b437e7..000000000 --- a/src/scripting/codegeneration/functioncalls.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#if 0 -/* -** cg_functioncall.cpp -** -**--------------------------------------------------------------------------- -** Copyright 2016 Christoph Oelckers -** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** 3. The name of the author may not be used to endorse or promote products -** derived from this software without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -**--------------------------------------------------------------------------- -** -*/ - -#include "doomtype.h" -#include "codegen.h" -#include "thingdef.h" -#include "zscript/zcc_parser.h" - -// just some rough concepts for now... - - -//========================================================================== -// -// -// -//========================================================================== - -FxExpression *ConvertFunctionCall(ZCC_Expression *function, FArgumentList *args, PClass *cls, FScriptPosition &sc) -{ - - switch(function->NodeType) - { - case AST_ExprID: - return new FxFunctionCall( ConvertSimpleFunctionCall(static_cast(function), args, cls, sc); - - case AST_ExprMemberAccess: - return ConvertMemberCall(fcall); - - case AST_ExprBinary: - // Array access syntax is wrapped into a ZCC_ExprBinary object. - break; - - default: - break; - } - Error(fcall, "Invalid function identifier"); - return new FxNop(*fcall); // return something so that we can continue -} - - - assert(fcall->Function->NodeType == AST_ExprID); // of course this cannot remain. Right now nothing more complex can come along but later this will have to be decomposed into 'self' and the actual function name. - auto fname = static_cast(fcall->Function)->Identifier; - return new FxFunctionCall(nullptr, fname, ConvertNodeList(fcall->Parameters), *ast); - -#endif \ No newline at end of file diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index 7e895d049..0d99ee5c2 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -2839,10 +2839,14 @@ FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast) } else if (args->Size() == 1) { + auto arg = (*args)[0]; + (*args)[0] = nullptr; + delete args; return new FxReturnStatement((*args)[0], *ast); } else { + delete args; Error(ast, "Return with multiple values not implemented yet."); return new FxReturnStatement(nullptr, *ast); } diff --git a/src/scripting/zscript/zcc_compile.h b/src/scripting/zscript/zcc_compile.h index c901fc42e..2e38d68d2 100644 --- a/src/scripting/zscript/zcc_compile.h +++ b/src/scripting/zscript/zcc_compile.h @@ -1,6 +1,8 @@ #ifndef ZCC_COMPILE_H #define ZCC_COMPILE_H +#include + struct Baggage; struct FPropertyInfo; class AActor;