diff options
author | daurnimator <quae@daurnimator.com> | 2017-04-27 17:20:28 +1000 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-04-28 14:15:58 +0200 |
commit | 18fde8bd2285ad45baa9f9b2f16b40fb6bd3b2dd (patch) | |
tree | 57a32acf8fc5f7149c94a8e979ed39b9dba7e912 /src/lapi.js | |
parent | 4cd7e4062219ccffbbc9e397e1ab599c26a3ae76 (diff) | |
download | fengari-18fde8bd2285ad45baa9f9b2f16b40fb6bd3b2dd.tar.gz fengari-18fde8bd2285ad45baa9f9b2f16b40fb6bd3b2dd.tar.bz2 fengari-18fde8bd2285ad45baa9f9b2f16b40fb6bd3b2dd.zip |
LClosure and CClosure shouldn't subclass TValue
Diffstat (limited to 'src/lapi.js')
-rw-r--r-- | src/lapi.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lapi.js b/src/lapi.js index 9c01e95..52bc8fa 100644 --- a/src/lapi.js +++ b/src/lapi.js @@ -54,7 +54,7 @@ const index2addr = function(L, idx) { if (ci.func.ttislcf()) /* light C function? */ return lobject.luaO_nilobject; /* it has no upvalues */ else { - return idx <= ci.func.nupvalues ? ci.func.upvalue[idx - 1] : lobject.luaO_nilobject; + return idx <= ci.func.value.nupvalues ? ci.func.value.upvalue[idx - 1] : lobject.luaO_nilobject; } } }; @@ -277,7 +277,7 @@ const lua_pushcclosure = function(L, fn, n) { cl.upvalue[n] = L.stack[L.top + n]; } - L.stack[L.top] = cl; + L.stack[L.top] = new TValue(CT.LUA_TCCL, cl); } L.top++; @@ -812,7 +812,7 @@ const lua_load = function(L, reader, data, chunckname, mode) { if (!chunckname) chunckname = [defs.char["?"]]; let status = ldo.luaD_protectedparser(L, z, chunckname, mode); if (status === TS.LUA_OK) { /* no errors? */ - let f = L.stack[L.top - 1]; /* get newly created function */ + let f = L.stack[L.top - 1].value; /* get newly created function */ if (f.nupvalues >= 1) { /* does it have an upvalue? */ /* get global table from registry */ let reg = L.l_G.l_registry; @@ -828,7 +828,7 @@ const lua_dump = function(L, writer, data, strip) { assert(1 < L.top - L.ci.funcOff, "not enough elements in the stack"); let o = L.stack[L.top -1]; if (o.ttisLclosure()) - return ldump.luaU_dump(L, o.p, writer, data, strip); + return ldump.luaU_dump(L, o.value.p, writer, data, strip); return 1; }; |