From 1d62172c02030d6bfbe7f3fc4ea2a938a3a33262 Mon Sep 17 00:00:00 2001 From: DerelictDrone <57756830+DerelictDrone@users.noreply.github.com> Date: Wed, 13 Dec 2023 05:07:52 -0600 Subject: [PATCH] Deref/memory assignments on constant labels fixed (#37) --- lua/wire/client/hlzasm/hc_codetree.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lua/wire/client/hlzasm/hc_codetree.lua b/lua/wire/client/hlzasm/hc_codetree.lua index e0e28f6..dbf4a92 100644 --- a/lua/wire/client/hlzasm/hc_codetree.lua +++ b/lua/wire/client/hlzasm/hc_codetree.lua @@ -210,11 +210,13 @@ function HCOMP:ReadOperandFromMemory(operands,index) operands[index] = { MemoryRegister = operands[index].MemoryPointer.Register, Temporary = operands[index].MemoryPointer.Temporary } return operands[index].Register elseif operands[index].MemoryPointer.Constant then + if istable(operands[index].MemoryPointer.Constant) then -- Don't decay a label constant expression into an unusable memory address if possible for _,item in pairs(operands[index].MemoryPointer.Constant) do - if item.Type == self.TOKEN.IDENT then - operands[index] = { MemoryPointer = operands[index].MemoryPointer.Constant } - return nil + if item.Type == self.TOKEN.IDENT then + operands[index] = { MemoryPointer = operands[index].MemoryPointer.Constant } + return nil + end end end operands[index] = { Memory = operands[index].MemoryPointer.Constant }