aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2018-01-18 06:07:37 +1100
committerdaurnimator <quae@daurnimator.com>2018-01-18 07:07:58 +1100
commite6da60c50ac35a7e5d5b6988053f1eea030d737c (patch)
tree09682bcc73a936ce2bce100a37f74ddf8deb6337
parent0110717f5e6c2a4ec202501f3d086afeed69029b (diff)
downloadfengari-e6da60c50ac35a7e5d5b6988053f1eea030d737c.tar.gz
fengari-e6da60c50ac35a7e5d5b6988053f1eea030d737c.tar.bz2
fengari-e6da60c50ac35a7e5d5b6988053f1eea030d737c.zip
src/ltable.js: Use lua_assert instead of assert
-rw-r--r--src/ltable.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/ltable.js b/src/ltable.js
index cf8b1da..87f8c6a 100644
--- a/src/ltable.js
+++ b/src/ltable.js
@@ -1,8 +1,7 @@
"use strict";
-const assert = require('assert');
-
const defs = require('./defs.js');
+const { lua_assert } = require('./llimits.js');
const ldebug = require('./ldebug.js');
const lobject = require('./lobject.js');
const lstring = require('./lstring.js');
@@ -151,17 +150,17 @@ const getgeneric = function(t, hash) {
};
const luaH_getint = function(t, key) {
- assert(typeof key == "number" && (key|0) === key);
+ lua_assert(typeof key == "number" && (key|0) === key);
return getgeneric(t, key);
};
const luaH_getstr = function(t, key) {
- assert(key instanceof lstring.TString);
+ lua_assert(key instanceof lstring.TString);
return getgeneric(t, lstring.luaS_hashlongstr(key));
};
const luaH_get = function(L, t, key) {
- assert(key instanceof lobject.TValue);
+ lua_assert(key instanceof lobject.TValue);
if (key.ttisnil() || (key.ttisfloat() && isNaN(key.value)))
return lobject.luaO_nilobject;
return getgeneric(t, table_hash(L, key));
@@ -185,7 +184,7 @@ const setgeneric = function(t, hash, key) {
};
const luaH_setint = function(t, key, value) {
- assert(typeof key == "number" && (key|0) === key && value instanceof lobject.TValue);
+ lua_assert(typeof key == "number" && (key|0) === key && value instanceof lobject.TValue);
let hash = key; /* table_hash known result */
if (value.ttisnil()) {
mark_dead(t, hash);
@@ -203,13 +202,13 @@ const luaH_setint = function(t, key, value) {
};
const luaH_set = function(L, t, key) {
- assert(key instanceof lobject.TValue);
+ lua_assert(key instanceof lobject.TValue);
let hash = table_hash(L, key);
return setgeneric(t, hash, key);
};
const luaH_delete = function(L, t, key) {
- assert(key instanceof lobject.TValue);
+ lua_assert(key instanceof lobject.TValue);
let hash = table_hash(L, key);
return mark_dead(t, hash);
};