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
|
if "string" == _exp_0 or DelayedLine == _exp_0 then
|
||||||
line_no = line_no + 1
|
line_no = line_no + 1
|
||||||
out[line_no] = posmap[i]
|
out[line_no] = posmap[i]
|
||||||
elseif "table" == _exp_0 then
|
elseif Lines == _exp_0 then
|
||||||
local _
|
local _
|
||||||
_, line_no = l:flatten_posmap(line_no, out)
|
_, line_no = l:flatten_posmap(line_no, out)
|
||||||
|
else
|
||||||
|
error("Unknown item in Lines: " .. tostring(l))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return out, line_no
|
return out, line_no
|
||||||
@ -101,8 +103,10 @@ do
|
|||||||
end
|
end
|
||||||
insert(buffer, "\n")
|
insert(buffer, "\n")
|
||||||
local last = l
|
local last = l
|
||||||
elseif "table" == _exp_0 then
|
elseif Lines == _exp_0 then
|
||||||
l:flatten(indent and indent .. indent_char or indent_char, buffer)
|
l:flatten(indent and indent .. indent_char or indent_char, buffer)
|
||||||
|
else
|
||||||
|
error("Unknown item in Lines: " .. tostring(l))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return buffer
|
return buffer
|
||||||
|
@ -45,8 +45,10 @@ class Lines
|
|||||||
when "string", DelayedLine
|
when "string", DelayedLine
|
||||||
line_no += 1
|
line_no += 1
|
||||||
out[line_no] = posmap[i]
|
out[line_no] = posmap[i]
|
||||||
when "table"
|
when Lines
|
||||||
_, line_no = l\flatten_posmap line_no, out
|
_, line_no = l\flatten_posmap line_no, out
|
||||||
|
else
|
||||||
|
error "Unknown item in Lines: #{l}"
|
||||||
|
|
||||||
out, line_no
|
out, line_no
|
||||||
|
|
||||||
@ -72,8 +74,10 @@ class Lines
|
|||||||
|
|
||||||
insert buffer, "\n"
|
insert buffer, "\n"
|
||||||
last = l
|
last = l
|
||||||
when "table" -- Lines
|
when Lines
|
||||||
l\flatten indent and indent .. indent_char or indent_char, buffer
|
l\flatten indent and indent .. indent_char or indent_char, buffer
|
||||||
|
else
|
||||||
|
error "Unknown item in Lines: #{l}"
|
||||||
buffer
|
buffer
|
||||||
|
|
||||||
__tostring: =>
|
__tostring: =>
|
||||||
|
Loading…
Reference in New Issue
Block a user