From fc153d51918557e2dcd4057dbdb0efe4a8b11b40 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Thu, 21 Apr 2016 02:56:33 -0700 Subject: [PATCH] fix label importing; cache data lengths --- lips/Dumper.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lips/Dumper.lua b/lips/Dumper.lua index 0881cdb..b6b721b 100644 --- a/lips/Dumper.lua +++ b/lips/Dumper.lua @@ -307,8 +307,6 @@ function Dumper:fill(length, content) end function Dumper:load(statements) - self.labels = {} - local pos = self.options.offset or 0 local new_statements = {} for i=1, #statements do @@ -319,7 +317,8 @@ function Dumper:load(statements) if s.type == '!LABEL' then self.labels[s[1].tok] = pos elseif s.type == '!DATA' then - pos = pos + util.measure_data(s) + s.length = util.measure_data(s) -- cache for next pass + pos = pos + s.length insert(new_statements, s) elseif s.type == '!ORG' then pos = s[1].tok @@ -387,7 +386,7 @@ function Dumper:load(statements) t.tok = {label} end end - self.pos = self.pos + util.measure_data(s) + self.pos = self.pos + s.length insert(new_statements, s) elseif s.type == '!ORG' then self.pos = s[1].tok