From a83fff0eb4b1a81cdf4fc776c396f93aeeaacd89 Mon Sep 17 00:00:00 2001 From: Chronos Ouroboros Date: Sun, 5 Jan 2020 19:07:03 -0300 Subject: [PATCH] Disabled default blocks in mixins for now. --- src/scripting/zscript/zcc_compile.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index 16d2dea473..1f8109a8f4 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -268,11 +268,9 @@ void ZCCCompiler::ProcessMixin(ZCC_MixinDef *cnode, PSymbolTreeNode *treenode) { ZCC_MixinWork *cls = new ZCC_MixinWork(cnode, treenode); - Mixins.Push(cls); - auto node = cnode->Body; - // Need to check if the class actually has a body. + // Need to check if the mixin actually has a body. if (node != nullptr) do { if (cnode->MixinType == ZCC_Mixin_Class) @@ -288,10 +286,13 @@ void ZCCCompiler::ProcessMixin(ZCC_MixinDef *cnode, PSymbolTreeNode *treenode) case AST_EnumTerminator: case AST_States: case AST_FuncDeclarator: - case AST_Default: case AST_StaticArrayStatement: break; + case AST_Default: + Error(node, "Default blocks currently disabled in mixins"); + return; + default: assert(0 && "Unhandled AST node type"); break; @@ -300,6 +301,8 @@ void ZCCCompiler::ProcessMixin(ZCC_MixinDef *cnode, PSymbolTreeNode *treenode) node = node->SiblingNext; } while (node != cnode->Body); + + Mixins.Push(cls); } //==========================================================================