From c4be74a5d33e8c92aa05ebda883361480a1000c6 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 20 Jul 2018 17:51:21 -0700 Subject: Simplifying and correcting the nomsu codegen. --- code_obj.moon | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'code_obj.moon') diff --git a/code_obj.moon b/code_obj.moon index 3d376bb..70b40c3 100644 --- a/code_obj.moon +++ b/code_obj.moon @@ -55,7 +55,8 @@ class Code dirty: => @__str = nil @_trailing_line_len = nil - @_is_multiline = nil + -- Multi-line only goes from false->true, since there is no API for removing bits + @_is_multiline = nil if @_is_multiline == false append: (...)=> n = select("#",...) @@ -67,6 +68,7 @@ class Code assert(not Source\is_instance(b), "code bit is a Source") if b == '' then continue bits[#bits+1] = b + b.dirty = error if b.is_code if type(b) != 'string' and not (type(b) == 'table' and b.is_code) b = repr(b) @dirty! @@ -104,6 +106,7 @@ class Code else bits[#bits+1] = joiner bits[#bits+1] = b + b.dirty = error if b.is_code b_str = tostring(b) line = match(b_str, "\n([^\n]*)$") if line @@ -118,7 +121,9 @@ class Code for i=#bits+n,n+1,-1 bits[i] = bits[i-n] for i=1,n - bits[i] = select(i, ...) + b = select(i, ...) + bits[i] = b + b.dirty = error if b.is_code @dirty! class LuaCode extends Code -- cgit v1.2.3