From aee0f65dea0456635e96b4496f6597188526e647 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Thu, 2 Mar 2017 11:31:05 +0100 Subject: [Parsing tests] SETTABUP, GETTABUP --- src/lcode.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lcode.js') diff --git a/src/lcode.js b/src/lcode.js index 64e890e..9380d1a 100644 --- a/src/lcode.js +++ b/src/lcode.js @@ -487,12 +487,12 @@ const addk = function(fs, key, v) { let idx = fs.ls.h.__index(fs.ls.h, key); /* index scanner table */ if (idx && !idx.ttisnil()) { /* is there an index there? */ /* correct value? (warning: must distinguish floats from integers!) */ - if (f.k[idx].ttype() === v.ttype() && f.k[idx].value === v.value) - return idx; /* reuse index */ + if (f.k[idx.value].ttype() === v.ttype() && f.k[idx.value].value === v.value) + return idx.value; /* reuse index */ } /* constant not found; create a new entry */ let k = fs.nk; - fs.ls.h.__newindex(fs.ls.h, key, k); + fs.ls.h.__newindex(fs.ls.h, key, new TValue(CT.LUA_TNUMINT, k)); f.k[k] = v; fs.nk++; return k; @@ -616,7 +616,7 @@ const luaK_dischargevars = function(fs, e) { op = OpCodesI.OP_GETTABUP; /* 't' is in an upvalue */ } e.u.info = luaK_codeABC(fs, op, 0, e.u.ind.t, e.u.ind.idx); - e.k = OpCodesI.VRELOCABLE; + e.k = ek.VRELOCABLE; break; } case ek.VVARARG: case ek.VCALL: { -- cgit v1.2.3-54-g00ecf