diff options
author | daurnimator <quae@daurnimator.com> | 2017-12-13 14:38:52 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-12-13 15:04:08 +1100 |
commit | d8e002a33c6b212891d09a2221edd0f516d13d9a (patch) | |
tree | 23b38ad181e2285fd7d467a3d4558ff175946410 | |
parent | eb71fa819bf294cb145360ce2d4697200b30bd11 (diff) | |
download | fengari-d8e002a33c6b212891d09a2221edd0f516d13d9a.tar.gz fengari-d8e002a33c6b212891d09a2221edd0f516d13d9a.tar.bz2 fengari-d8e002a33c6b212891d09a2221edd0f516d13d9a.zip |
src/lapi.js: Remove emptystring: rely on internal string cache instead
-rw-r--r-- | src/lapi.js | 8 | ||||
-rw-r--r-- | src/ldebug.js | 2 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/lapi.js b/src/lapi.js index 9e2f0a3..afa94ce 100644 --- a/src/lapi.js +++ b/src/lapi.js @@ -230,13 +230,11 @@ const lua_pushinteger = function(L, n) { assert(L.top <= L.ci.top, "stack overflow"); }; -const emptystring = defs.to_luastring(""); - const lua_pushlstring = function(L, s, len) { assert(typeof len === "number"); let ts; if (len === 0) { - s = emptystring; + s = defs.to_luastring("", true); } else { assert(defs.is_luastring(s) && s.length >= len, "lua_pushlstring expects array of byte"); s = s.slice(0, len); @@ -525,7 +523,7 @@ const aux_upvalue = function(L, fi, n) { let f = fi.value; if (!(1 <= n && n <= f.nupvalues)) return null; return { - name: [], + name: defs.to_luastring("", true), val: f.upvalue[n-1] }; } @@ -1059,7 +1057,7 @@ const lua_concat = function(L, n) { if (n >= 2) lvm.luaV_concat(L, n); else if (n === 0) { - lobject.pushsvalue2s(L, lstring.luaS_bless(L, emptystring)); + lobject.pushsvalue2s(L, lstring.luaS_bless(L, defs.to_luastring("", true))); assert(L.top <= L.ci.top, "stack overflow"); } }; diff --git a/src/ldebug.js b/src/ldebug.js index 58bccc9..c93df91 100644 --- a/src/ldebug.js +++ b/src/ldebug.js @@ -247,7 +247,7 @@ const auxgetinfo = function(L, what, ar, f, ci) { case 'n': { let r = getfuncname(L, ci); if (r === null) { - ar.namewhat = defs.to_luastring(""); + ar.namewhat = defs.to_luastring("", true); ar.name = null; } else { ar.namewhat = r.funcname; |