aboutsummaryrefslogtreecommitdiff
path: root/code_obj.lua
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.lua
parent9f0b5384d792aae309645875f5c138d36c7c60a9 (diff)
Simplifying and correcting the nomsu codegen.
Diffstat (limited to 'code_obj.lua')
-rw-r--r--code_obj.lua16
1 files changed, 14 insertions, 2 deletions
diff --git a/code_obj.lua b/code_obj.lua
index 51d9b00..8a51832 100644
--- a/code_obj.lua
+++ b/code_obj.lua
@@ -83,7 +83,9 @@ do
dirty = function(self)
self.__str = nil
self._trailing_line_len = nil
- self._is_multiline = nil
+ if self._is_multiline == false then
+ self._is_multiline = nil
+ end
end,
append = function(self, ...)
local n = select("#", ...)
@@ -100,6 +102,9 @@ do
break
end
bits[#bits + 1] = b
+ if b.is_code then
+ b.dirty = error
+ end
if type(b) ~= 'string' and not (type(b) == 'table' and b.is_code) then
b = repr(b)
end
@@ -153,6 +158,9 @@ do
end
end
bits[#bits + 1] = b
+ if b.is_code then
+ b.dirty = error
+ end
local b_str = tostring(b)
local line = match(b_str, "\n([^\n]*)$")
if line then
@@ -170,7 +178,11 @@ do
bits[i] = bits[i - n]
end
for i = 1, n do
- bits[i] = select(i, ...)
+ local b = select(i, ...)
+ bits[i] = b
+ if b.is_code then
+ b.dirty = error
+ end
end
return self:dirty()
end