diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2018-11-08 15:23:22 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2018-11-08 15:24:15 -0800 |
| commit | 652c29bdef1f0991cc13bef59d6dc78b657ae9a4 (patch) | |
| tree | 8e335399e77b1893657b9fa985db0738034daac3 /code_obj.lua | |
| parent | 1f3660f393c1a17988a15b89f18686b28e51a9e7 (diff) | |
Major overhaul, splitting nomsu_compiler into nomsu_environment,
nomsu_compiler, and nomsu_decompiler. Also added comprehensions.
Diffstat (limited to 'code_obj.lua')
| -rw-r--r-- | code_obj.lua | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/code_obj.lua b/code_obj.lua index 7d335e0..124064f 100644 --- a/code_obj.lua +++ b/code_obj.lua @@ -265,6 +265,10 @@ do end }) _base_0.__class = _class_0 + local self = _class_0 + self.is_instance = function(self, x) + return type(x) == 'table' and x.__class == self + end Code = _class_0 end do @@ -373,7 +377,7 @@ do if suffix == nil then suffix = ";" end - if not (self.is_value) then + if self:text():matches(";$") or self:text() == "" then return self end local statements = LuaCode(self.source) @@ -415,7 +419,6 @@ do } end, parenthesize = function(self) - assert(self.is_value, "Cannot parenthesize lua statements") self:prepend("(") return self:append(")") end @@ -426,7 +429,6 @@ do __init = function(self, ...) _class_0.__parent.__init(self, ...) self.free_vars = { } - self.is_value = false end, __base = _base_0, __name = "LuaCode", @@ -450,12 +452,6 @@ do end }) _base_0.__class = _class_0 - local self = _class_0 - self.Value = function(...) - local lua = LuaCode(...) - lua.is_value = true - return lua - end if _parent_0.__inherited then _parent_0.__inherited(_parent_0, _class_0) end |
