1
0
Fork 0
mirror of https://github.com/notwa/lips synced 2024-05-03 01:53:23 -07:00

fix label importing; cache data lengths

This commit is contained in:
Connor Olding 2016-04-21 02:56:33 -07:00
parent 901d7ceac5
commit fc153d5191

View File

@ -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