mirror of
https://github.com/leafo/moonscript.git
synced 2025-01-09 00:04:22 +00:00
correctly check types, issue from DelayedLine
This commit is contained in:
parent
54dc8efa0b
commit
19032214a8
@ -66,9 +66,11 @@ do
|
||||
if "string" == _exp_0 or DelayedLine == _exp_0 then
|
||||
line_no = line_no + 1
|
||||
out[line_no] = posmap[i]
|
||||
elseif "table" == _exp_0 then
|
||||
elseif Lines == _exp_0 then
|
||||
local _
|
||||
_, line_no = l:flatten_posmap(line_no, out)
|
||||
else
|
||||
error("Unknown item in Lines: " .. tostring(l))
|
||||
end
|
||||
end
|
||||
return out, line_no
|
||||
@ -101,8 +103,10 @@ do
|
||||
end
|
||||
insert(buffer, "\n")
|
||||
local last = l
|
||||
elseif "table" == _exp_0 then
|
||||
elseif Lines == _exp_0 then
|
||||
l:flatten(indent and indent .. indent_char or indent_char, buffer)
|
||||
else
|
||||
error("Unknown item in Lines: " .. tostring(l))
|
||||
end
|
||||
end
|
||||
return buffer
|
||||
|
@ -45,8 +45,10 @@ class Lines
|
||||
when "string", DelayedLine
|
||||
line_no += 1
|
||||
out[line_no] = posmap[i]
|
||||
when "table"
|
||||
when Lines
|
||||
_, line_no = l\flatten_posmap line_no, out
|
||||
else
|
||||
error "Unknown item in Lines: #{l}"
|
||||
|
||||
out, line_no
|
||||
|
||||
@ -72,8 +74,10 @@ class Lines
|
||||
|
||||
insert buffer, "\n"
|
||||
last = l
|
||||
when "table" -- Lines
|
||||
when Lines
|
||||
l\flatten indent and indent .. indent_char or indent_char, buffer
|
||||
else
|
||||
error "Unknown item in Lines: #{l}"
|
||||
buffer
|
||||
|
||||
__tostring: =>
|
||||
|
Loading…
Reference in New Issue
Block a user