aboutsummaryrefslogtreecommitdiff
path: root/src/ltm.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-04-18 11:38:21 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-04-18 11:38:21 +0200
commit6be8db07196c407cd321a7b04f5022939c4ffce3 (patch)
tree1e979f818d2139a23a749d8536d8cc12b4858037 /src/ltm.js
parent4f415e5ca594c5b60e6fa6315b69acb41273ee7e (diff)
downloadfengari-6be8db07196c407cd321a7b04f5022939c4ffce3.tar.gz
fengari-6be8db07196c407cd321a7b04f5022939c4ffce3.tar.bz2
fengari-6be8db07196c407cd321a7b04f5022939c4ffce3.zip
Cache all to_luastring of internal literals
Diffstat (limited to 'src/ltm.js')
-rw-r--r--src/ltm.js54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/ltm.js b/src/ltm.js
index 4a90f6d..57c2e3f 100644
--- a/src/ltm.js
+++ b/src/ltm.js
@@ -15,30 +15,30 @@ const CT = lua.constant_types;
const TMS = {
- TM_INDEX: lua.to_luastring("__index"),
- TM_NEWINDEX: lua.to_luastring("__newindex"),
- TM_GC: lua.to_luastring("__gc"),
- TM_MODE: lua.to_luastring("__mode"),
- TM_LEN: lua.to_luastring("__len"),
- TM_EQ: lua.to_luastring("__eq"), /* last tag method with fast access */
- TM_ADD: lua.to_luastring("__add"),
- TM_SUB: lua.to_luastring("__sub"),
- TM_MUL: lua.to_luastring("__mul"),
- TM_MOD: lua.to_luastring("__mod"),
- TM_POW: lua.to_luastring("__pow"),
- TM_DIV: lua.to_luastring("__div"),
- TM_IDIV: lua.to_luastring("__idiv"),
- TM_BAND: lua.to_luastring("__band"),
- TM_BOR: lua.to_luastring("__bor"),
- TM_BXOR: lua.to_luastring("__bxor"),
- TM_SHL: lua.to_luastring("__shl"),
- TM_SHR: lua.to_luastring("__shr"),
- TM_UNM: lua.to_luastring("__unm"),
- TM_BNOT: lua.to_luastring("__bnot"),
- TM_LT: lua.to_luastring("__lt"),
- TM_LE: lua.to_luastring("__le"),
- TM_CONCAT: lua.to_luastring("__concat"),
- TM_CALL: lua.to_luastring("__call")
+ TM_INDEX: lua.to_luastring("__index", true),
+ TM_NEWINDEX: lua.to_luastring("__newindex", true),
+ TM_GC: lua.to_luastring("__gc", true),
+ TM_MODE: lua.to_luastring("__mode", true),
+ TM_LEN: lua.to_luastring("__len", true),
+ TM_EQ: lua.to_luastring("__eq", true), /* last tag method with fast access */
+ TM_ADD: lua.to_luastring("__add", true),
+ TM_SUB: lua.to_luastring("__sub", true),
+ TM_MUL: lua.to_luastring("__mul", true),
+ TM_MOD: lua.to_luastring("__mod", true),
+ TM_POW: lua.to_luastring("__pow", true),
+ TM_DIV: lua.to_luastring("__div", true),
+ TM_IDIV: lua.to_luastring("__idiv", true),
+ TM_BAND: lua.to_luastring("__band", true),
+ TM_BOR: lua.to_luastring("__bor", true),
+ TM_BXOR: lua.to_luastring("__bxor", true),
+ TM_SHL: lua.to_luastring("__shl", true),
+ TM_SHR: lua.to_luastring("__shr", true),
+ TM_UNM: lua.to_luastring("__unm", true),
+ TM_BNOT: lua.to_luastring("__bnot", true),
+ TM_LT: lua.to_luastring("__lt", true),
+ TM_LE: lua.to_luastring("__le", true),
+ TM_CONCAT: lua.to_luastring("__concat", true),
+ TM_CALL: lua.to_luastring("__call", true)
};
const luaT_typenames_ = [
@@ -71,7 +71,7 @@ const luaT_init = function(L) {
*/
const luaT_objtypename = function(L, o) {
if ((o.ttistable() && o.metatable !== null) || (o.ttisfulluserdata() && o.metatable !== null)) {
- let name = o.__index(o, lua.to_luastring('__name'));
+ let name = o.__index(o, lua.to_luastring('__name', true));
if (name.ttisstring())
return name.jsstring();
}
@@ -123,10 +123,10 @@ const luaT_trybinTM = function(L, p1, p2, res, event) {
if (n1 !== false && n2 !== false)
ldebug.luaG_tointerror(L, p1, p2);
else
- ldebug.luaG_opinterror(L, p1, p2, lua.to_luastring("perform bitwise operation on"));
+ ldebug.luaG_opinterror(L, p1, p2, lua.to_luastring("perform bitwise operation on", true));
}
default:
- ldebug.luaG_opinterror(L, p1, p2, lua.to_luastring("perform arithmetic on"));
+ ldebug.luaG_opinterror(L, p1, p2, lua.to_luastring("perform arithmetic on", true));
}
}
};