aboutsummaryrefslogtreecommitdiff
path: root/code_obj.lua
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-06-26 15:52:38 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-06-26 15:53:00 -0700
commit65dc1f2196b46dbd527d49da113515bea825416d (patch)
tree02dbbe6528dc9c4a1e71a522da624a08f1179d64 /code_obj.lua
parent42578872c72ec46b256a093f74482fb6e5b8e4b9 (diff)
Cleaning up metaprogramming a bit and fixing/adding test for recursion
control flow.
Diffstat (limited to 'code_obj.lua')
-rw-r--r--code_obj.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/code_obj.lua b/code_obj.lua
index de62c8f..e3f7b16 100644
--- a/code_obj.lua
+++ b/code_obj.lua
@@ -297,6 +297,12 @@ do
end
return statements
end,
+ as_expr = function(self)
+ if self.is_value then
+ return self
+ end
+ return error("Cannot convert to expression: " .. tostring(tostring(self)))
+ end,
__tostring = function(self)
if self.__str == nil then
local buff, indents = { }, self.indents