aboutsummaryrefslogtreecommitdiff
path: root/src/lobject.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-12-11 15:48:32 +1100
committerdaurnimator <quae@daurnimator.com>2017-12-11 16:00:06 +1100
commitd99cc3be545aa7f827030ec0ac502c00f530f8bf (patch)
treec30ac6bcffb88a58dce452f9ac5dda36245ff8c9 /src/lobject.js
parent5b564fb8e230f98b672aea534c16d7d99ffe1944 (diff)
downloadfengari-d99cc3be545aa7f827030ec0ac502c00f530f8bf.tar.gz
fengari-d99cc3be545aa7f827030ec0ac502c00f530f8bf.tar.bz2
fengari-d99cc3be545aa7f827030ec0ac502c00f530f8bf.zip
src/{llex,lobject}.js: Fix luaO_utf8esc/luaO_utf8desc confusion
Diffstat (limited to 'src/lobject.js')
-rw-r--r--src/lobject.js24
1 files changed, 1 insertions, 23 deletions
diff --git a/src/lobject.js b/src/lobject.js
index becec17..e69a9ef 100644
--- a/src/lobject.js
+++ b/src/lobject.js
@@ -336,7 +336,7 @@ const luaO_hexavalue = function(c) {
const UTF8BUFFSZ = 8;
-const luaO_utf8desc = function(buff, x) {
+const luaO_utf8esc = function(buff, x) {
let n = 1; /* number of bytes put in buffer (backwards) */
assert(x <= 0x10FFFF);
if (x < 0x80) /* ascii? */
@@ -491,27 +491,6 @@ const luaO_str2num = function(s) {
}
};
-const luaO_utf8esc = function(x) {
- let buff = [];
- let n = 1; /* number of bytes put in buffer (backwards) */
- assert(x <= 0x10ffff);
- if (x < 0x80) /* ascii? */
- buff[UTF8BUFFSZ - 1] = x;
- else { /* need continuation bytes */
- let mfb = 0x3f; /* maximum that fits in first byte */
- do { /* add continuation bytes */
- buff[UTF8BUFFSZ - (n++)] = 0x80 | (x & 0x3f);
- x >>= 6; /* remove added bits */
- mfb >>= 1; /* now there is one less bit available in first byte */
- } while (x > mfb); /* still needs continuation byte? */
- buff[UTF8BUFFSZ - n] = (~mfb << 1) | x; /* add first byte */
- }
- return {
- buff: buff,
- n: n
- };
-};
-
/* this currently returns new TValue instead of modifying */
const luaO_tostring = function(L, obj) {
let buff;
@@ -733,7 +712,6 @@ module.exports.luaO_pushfstring = luaO_pushfstring;
module.exports.luaO_pushvfstring = luaO_pushvfstring;
module.exports.luaO_str2num = luaO_str2num;
module.exports.luaO_tostring = luaO_tostring;
-module.exports.luaO_utf8desc = luaO_utf8desc;
module.exports.luaO_utf8esc = luaO_utf8esc;
module.exports.numarith = numarith;
module.exports.pushobj2s = pushobj2s;