summaryrefslogtreecommitdiff
path: root/src/lcode.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-02 11:31:05 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-02 11:31:05 +0100
commitaee0f65dea0456635e96b4496f6597188526e647 (patch)
tree3afcb057b08b3a6b7ce091111e7be0db236ff3f4 /src/lcode.js
parenteb838303ed7c3ddc2da0665ed0b5ca3843bf7b96 (diff)
downloadfengari-aee0f65dea0456635e96b4496f6597188526e647.tar.gz
fengari-aee0f65dea0456635e96b4496f6597188526e647.tar.bz2
fengari-aee0f65dea0456635e96b4496f6597188526e647.zip
[Parsing tests] SETTABUP, GETTABUP
Diffstat (limited to 'src/lcode.js')
-rw-r--r--src/lcode.js8
1 files changed, 4 insertions, 4 deletions
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: {