aboutsummaryrefslogtreecommitdiff
path: root/nomsu.lua
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-05-29 11:13:58 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-05-29 11:14:07 -0700
commite17822d1e548f96952efb95c64c69704fdfeaf76 (patch)
tree209d604ac323c36453730bc354e2c7d8e467e121 /nomsu.lua
parentb6be516e3fbc082b1dbd9740b95185976f4b0040 (diff)
Cleaned up some asserts for performance.
Diffstat (limited to 'nomsu.lua')
-rw-r--r--nomsu.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/nomsu.lua b/nomsu.lua
index 2587080..10c907f 100644
--- a/nomsu.lua
+++ b/nomsu.lua
@@ -1,7 +1,7 @@
local _pairs, _ipairs = pairs, ipairs
if jit then
package.cpath = "./luajit_lpeg/?.so;" .. package.cpath
- lpeg = require("lpeglj")
+ lpeg = require('lpeg')
bit32 = require('bit')
pairs = function(x)
do
@@ -269,7 +269,9 @@ do
if is_compile_action == nil then
is_compile_action = false
end
- assert(type(fn) == 'function', "Bad fn: " .. tostring(repr(fn)))
+ if type(fn) ~= 'function' then
+ error("Not a function: " .. tostring(repr(fn)))
+ end
if type(signature) == 'string' then
signature = {
signature
@@ -354,7 +356,9 @@ do
return nil
end
local tree = self:parse(nomsu_code)
- assert(tree, "Failed to parse: " .. tostring(nomsu_code))
+ if not (tree) then
+ error("Failed to parse: " .. tostring(nomsu_code))
+ end
local lua = self:tree_to_lua(tree):as_statements()
lua:declare_locals()
lua:prepend("-- File: " .. tostring(nomsu_code.source or "") .. "\n")