Skip to content

Commit 1903221

Browse files
committed
correctly check types, issue from DelayedLine
1 parent 54dc8ef commit 1903221

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

moonscript/compile.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ do
6666
if "string" == _exp_0 or DelayedLine == _exp_0 then
6767
line_no = line_no + 1
6868
out[line_no] = posmap[i]
69-
elseif "table" == _exp_0 then
69+
elseif Lines == _exp_0 then
7070
local _
7171
_, line_no = l:flatten_posmap(line_no, out)
72+
else
73+
error("Unknown item in Lines: " .. tostring(l))
7274
end
7375
end
7476
return out, line_no
@@ -101,8 +103,10 @@ do
101103
end
102104
insert(buffer, "\n")
103105
local last = l
104-
elseif "table" == _exp_0 then
106+
elseif Lines == _exp_0 then
105107
l:flatten(indent and indent .. indent_char or indent_char, buffer)
108+
else
109+
error("Unknown item in Lines: " .. tostring(l))
106110
end
107111
end
108112
return buffer

moonscript/compile.moon

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ class Lines
4545
when "string", DelayedLine
4646
line_no += 1
4747
out[line_no] = posmap[i]
48-
when "table"
48+
when Lines
4949
_, line_no = l\flatten_posmap line_no, out
50+
else
51+
error "Unknown item in Lines: #{l}"
5052

5153
out, line_no
5254

@@ -72,8 +74,10 @@ class Lines
7274

7375
insert buffer, "\n"
7476
last = l
75-
when "table" -- Lines
77+
when Lines
7678
l\flatten indent and indent .. indent_char or indent_char, buffer
79+
else
80+
error "Unknown item in Lines: #{l}"
7781
buffer
7882

7983
__tostring: =>

0 commit comments

Comments
 (0)