From 5151547df0be103b17a563af40bb9f8f5145ffa9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 9 Nov 2016 20:28:46 +0100 Subject: [PATCH] - fixed: String comparisons with constants did not work. --- src/scripting/codegeneration/codegen.cpp | 5 +++++ src/scripting/zscript/zcc_compile.cpp | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/scripting/codegeneration/codegen.cpp b/src/scripting/codegeneration/codegen.cpp index 63302d600..af92bf72f 100644 --- a/src/scripting/codegeneration/codegen.cpp +++ b/src/scripting/codegeneration/codegen.cpp @@ -3251,10 +3251,15 @@ ExpEmit FxCompareEq::Emit(VMFunctionBuilder *build) int a = Operator == TK_Eq ? CMP_EQ : Operator == TK_Neq ? CMP_EQ | CMP_CHECK : CMP_EQ | CMP_APPROX; + if (op1.Konst) a|= CMP_BK; + if (op2.Konst) a |= CMP_CK; + build->Emit(OP_LI, to.RegNum, 0, 0); build->Emit(OP_CMPS, a, op1.RegNum, op2.RegNum); build->Emit(OP_JMP, 1); build->Emit(OP_LI, to.RegNum, 1); + op1.Free(build); + op2.Free(build); return to; } else diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index 421b27fb1..7e895d049 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -497,6 +497,8 @@ void ZCCCompiler::CreateClassTypes() DPrintf(DMSG_SPAMMY, "Registered %s as native with parent %s\n", me->TypeName.GetChars(), parent->TypeName.GetChars()); } c->cls->Type = me; + auto ac = dyn_cast(me); + if (ac != nullptr) ac->SourceLumpName = *c->cls->SourceName; } else {