From 19032214a8a9c7f0e86e225755afd0bab5dc4d3b Mon Sep 17 00:00:00 2001 From: leaf corcoran Date: Fri, 11 Jan 2013 10:06:03 -0800 Subject: [PATCH] correctly check types, issue from DelayedLine --- moonscript/compile.lua | 8 ++++++-- moonscript/compile.moon | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/moonscript/compile.lua b/moonscript/compile.lua index 1772c8d..57fd30b 100644 --- a/moonscript/compile.lua +++ b/moonscript/compile.lua @@ -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 diff --git a/moonscript/compile.moon b/moonscript/compile.moon index 91068e9..c6249c8 100644 --- a/moonscript/compile.moon +++ b/moonscript/compile.moon @@ -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: =>