summaryrefslogtreecommitdiff
path: root/src/lcode.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-02 09:33:31 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-03-02 09:49:35 +0100
commit7ad7432bcf5e0666b719c768c3c0041fbb574feb (patch)
tree92d21ef0c1cbe08e988c0339a51f122c378e52b1 /src/lcode.js
parent5a0db9d250115470589d23cd8ad4b28982cabe06 (diff)
downloadfengari-7ad7432bcf5e0666b719c768c3c0041fbb574feb.tar.gz
fengari-7ad7432bcf5e0666b719c768c3c0041fbb574feb.tar.bz2
fengari-7ad7432bcf5e0666b719c768c3c0041fbb574feb.zip
[Parsing tests] TESTSET
Diffstat (limited to 'src/lcode.js')
-rw-r--r--src/lcode.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lcode.js b/src/lcode.js
index c4b8b81..64e890e 100644
--- a/src/lcode.js
+++ b/src/lcode.js
@@ -90,8 +90,8 @@ const BinOpr = {
OPR_GT: 17,
OPR_GE: 18,
OPR_AND: 19,
- OPR_OR: 21,
- OPR_NOBINOPR: 22
+ OPR_OR: 20,
+ OPR_NOBINOPR: 21
};
const UnOpr = {
@@ -359,7 +359,7 @@ const luaK_patchclose = function(fs, list, level) {
** line information. Return 'i' position.
*/
const luaK_code = function(fs, i) {
- // console.log(OpCodes[i.opcode]);
+ console.log(`${i.opcode}\t${i.A}\t${i.B}\t${i.C}\t${i.Ax}\t${i.Bx}\t${i.sBx}`);
let f = fs.f;
dischargejpc(fs); /* 'pc' will change */
/* put new instruction in code array */
@@ -1163,14 +1163,14 @@ const luaK_posfix = function(fs, op, e1, e2, line) {
assert(e1.t === NO_JUMP); /* list closed by 'luK_infix' */
luaK_dischargevars(fs, e2);
e2.f = luaK_concat(fs, e2.f, e1.f);
- // WARN: *e1 = *e2;
+ e1.to(e2);
break;
}
case BinOpr.OPR_OR: {
assert(e1.f === NO_JUMP); /* list closed by 'luK_infix' */
luaK_dischargevars(fs, e2);
e2.t = luaK_concat(fs, e2.t, e1.t);
- // WARN: *e1 = *e2;
+ e1.to(e2);
break;
}
case BinOpr.OPR_CONCAT: {
@@ -1202,6 +1202,8 @@ const luaK_posfix = function(fs, op, e1, e2, line) {
break;
}
}
+
+ return e1;
};
/*