diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2017-11-01 16:49:11 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2017-11-01 16:49:11 -0700 |
| commit | f1a2c936de700ddf1c7ccb650be9598db40c13d4 (patch) | |
| tree | 237ac9a52295f0c5dbc0dbb5624e0c2e5940f263 /nomsu.lua | |
| parent | cbd876673a4accc23aca16c015c20b819a2685b5 (diff) | |
Fixed some codegen stuff, optimized "say" for the common case of string
literals.
Diffstat (limited to 'nomsu.lua')
| -rw-r--r-- | nomsu.lua | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -479,7 +479,12 @@ end);]]):format(statements or "", expr or "ret") self:errorln(debug.traceback()) self:error(ret) end - insert(buffer, tostring(statements or '') .. "\n" .. tostring(expr and "ret = " .. tostring(expr) .. ";" or '')) + if statements then + insert(buffer, statements) + end + if expr then + insert(buffer, "ret = " .. tostring(expr) .. ";") + end end if max_operations then debug.sethook() @@ -488,7 +493,7 @@ end);]]):format(statements or "", expr or "ret") local ret; %s return ret; -end);]]):format(concat(buffer, "")) +end);]]):format(concat(buffer, "\n")) return return_value, lua_code, vars end, tree_to_value = function(self, tree, vars) @@ -911,7 +916,7 @@ end)]]):format(concat(lua_bits, "\n")) end return concat(stub, " "), arg_names else - return self:error("Unsupported get stub type: " .. tostring(x.type)) + return self:error("Unsupported get stub type: " .. tostring(x.type) .. " for " .. tostring(repr(x))) end end, get_stubs = function(self, x) |
