summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2018-01-06 23:17:24 +1100
committerdaurnimator <quae@daurnimator.com>2018-01-06 23:17:24 +1100
commit013d6acd9a22a42e4e59d0f7f1394448e98746c3 (patch)
tree78cfec267f74f972be862b061a9f03099cf600b7
parent85d59de1f56a8a1a7daa4ed6d1c68136924ff73f (diff)
downloadfengari-013d6acd9a22a42e4e59d0f7f1394448e98746c3.tar.gz
fengari-013d6acd9a22a42e4e59d0f7f1394448e98746c3.tar.bz2
fengari-013d6acd9a22a42e4e59d0f7f1394448e98746c3.zip
src/defs: Rename luastring_cmp to luastring_eq
-rw-r--r--src/defs.js4
-rw-r--r--src/ldebug.js4
-rw-r--r--src/lstring.js2
-rw-r--r--src/lundump.js2
4 files changed, 6 insertions, 6 deletions
diff --git a/src/defs.js b/src/defs.js
index 0c4ccd8..c836f07 100644
--- a/src/defs.js
+++ b/src/defs.js
@@ -158,7 +158,7 @@ const is_luastring = function(s) {
};
/* test two lua strings for equality */
-const luastring_cmp = function(a, b) {
+const luastring_eq = function(a, b) {
return a === b || (a.length === b.length && a.join() === b.join());
};
@@ -462,7 +462,7 @@ module.exports.lua_Debug = lua_Debug;
module.exports.lua_upvalueindex = lua_upvalueindex;
module.exports.thread_status = thread_status;
module.exports.is_luastring = is_luastring;
-module.exports.luastring_cmp = luastring_cmp;
+module.exports.luastring_eq = luastring_eq;
module.exports.luastring_from = luastring_from;
module.exports.luastring_of = luastring_of;
module.exports.to_jsstring = to_jsstring;
diff --git a/src/ldebug.js b/src/ldebug.js
index 1bb7a8a..3d722e1 100644
--- a/src/ldebug.js
+++ b/src/ldebug.js
@@ -403,7 +403,7 @@ const getobjname = function(p, lastpc, reg) {
let t = i.B; /* table index */
let vn = i.opcode === OCi.OP_GETTABLE ? lfunc.luaF_getlocalname(p, t + 1, pc) : upvalname(p, t);
r.name = kname(p, pc, k).name;
- r.funcname = (vn && defs.luastring_cmp(vn, llex.LUA_ENV)) ? defs.to_luastring("global", true) : defs.to_luastring("field", true);
+ r.funcname = (vn && defs.luastring_eq(vn, llex.LUA_ENV)) ? defs.to_luastring("global", true) : defs.to_luastring("field", true);
return r;
}
case OCi.OP_GETUPVAL: {
@@ -567,7 +567,7 @@ const luaG_opinterror = function(L, p1, p2, msg) {
const luaG_ordererror = function(L, p1, p2) {
let t1 = ltm.luaT_objtypename(L, p1);
let t2 = ltm.luaT_objtypename(L, p2);
- if (defs.luastring_cmp(t1, t2))
+ if (defs.luastring_eq(t1, t2))
luaG_runerror(L, defs.to_luastring("attempt to compare two %s values", true), t1);
else
luaG_runerror(L, defs.to_luastring("attempt to compare %s with %s", true), t1, t2);
diff --git a/src/lstring.js b/src/lstring.js
index 4350165..c145b53 100644
--- a/src/lstring.js
+++ b/src/lstring.js
@@ -24,7 +24,7 @@ class TString {
const luaS_eqlngstr = function(a, b) {
assert(a instanceof TString);
assert(b instanceof TString);
- return a == b || defs.luastring_cmp(a.realstring, b.realstring);
+ return a == b || defs.luastring_eq(a.realstring, b.realstring);
};
/* converts strings (arrays) to a consistent map key
diff --git a/src/lundump.js b/src/lundump.js
index e49c376..ee1e738 100644
--- a/src/lundump.js
+++ b/src/lundump.js
@@ -214,7 +214,7 @@ class BytecodeParser {
checkliteral(s, msg) {
let buff = this.read(s.length);
- if (!defs.luastring_cmp(buff, s))
+ if (!defs.luastring_eq(buff, s))
this.error(msg);
}