aboutsummaryrefslogtreecommitdiff
path: root/code_obj.moon
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-07-20 17:51:21 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-07-20 17:51:33 -0700
commitc4be74a5d33e8c92aa05ebda883361480a1000c6 (patch)
tree788b13a4a87f5a965c9ddc9c604ebec77e8f70a3 /code_obj.moon
parent9f0b5384d792aae309645875f5c138d36c7c60a9 (diff)
Simplifying and correcting the nomsu codegen.
Diffstat (limited to 'code_obj.moon')
-rw-r--r--code_obj.moon9
1 files changed, 7 insertions, 2 deletions
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