mirror of
https://github.com/notwa/lips
synced 2024-11-14 18:39:02 -08:00
fix label importing; cache data lengths
This commit is contained in:
parent
901d7ceac5
commit
fc153d5191
1 changed files with 3 additions and 4 deletions
|
@ -307,8 +307,6 @@ function Dumper:fill(length, content)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Dumper:load(statements)
|
function Dumper:load(statements)
|
||||||
self.labels = {}
|
|
||||||
|
|
||||||
local pos = self.options.offset or 0
|
local pos = self.options.offset or 0
|
||||||
local new_statements = {}
|
local new_statements = {}
|
||||||
for i=1, #statements do
|
for i=1, #statements do
|
||||||
|
@ -319,7 +317,8 @@ function Dumper:load(statements)
|
||||||
if s.type == '!LABEL' then
|
if s.type == '!LABEL' then
|
||||||
self.labels[s[1].tok] = pos
|
self.labels[s[1].tok] = pos
|
||||||
elseif s.type == '!DATA' then
|
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)
|
insert(new_statements, s)
|
||||||
elseif s.type == '!ORG' then
|
elseif s.type == '!ORG' then
|
||||||
pos = s[1].tok
|
pos = s[1].tok
|
||||||
|
@ -387,7 +386,7 @@ function Dumper:load(statements)
|
||||||
t.tok = {label}
|
t.tok = {label}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.pos = self.pos + util.measure_data(s)
|
self.pos = self.pos + s.length
|
||||||
insert(new_statements, s)
|
insert(new_statements, s)
|
||||||
elseif s.type == '!ORG' then
|
elseif s.type == '!ORG' then
|
||||||
self.pos = s[1].tok
|
self.pos = s[1].tok
|
||||||
|
|
Loading…
Reference in a new issue