From 005223711f4e11da5c8f24d19d6e8a6b64f603a8 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Thu, 2 Mar 2017 14:05:01 +0100 Subject: [Parsing tests] TFORCALL, TFORLOOP --- src/lparser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lparser.js b/src/lparser.js index 9c52c59..7fa3f16 100644 --- a/src/lparser.js +++ b/src/lparser.js @@ -1240,7 +1240,7 @@ const forbody = function(ls, base, line, nvars, isnum) { if (isnum) /* end of scope for declared variables */ endfor = lcode.luaK_codeAsBx(fs, OpCodesI.OP_FORLOOP, base, lcode.NO_JUMP); else { /* generic for */ - lcode.luaK_codeABC(fs, OpCodesI.OP_TFORLOOP, base + 2, lcode.NO_JUMP); + lcode.luaK_codeABC(fs, OpCodesI.OP_TFORCALL, base, 0, nvars); lcode.luaK_fixline(fs, line); endfor = lcode.luaK_codeAsBx(fs, OpCodesI.OP_TFORLOOP, base + 2, lcode.NO_JUMP); } @@ -1274,7 +1274,7 @@ const forlist = function(ls, indexname) { let fs = ls.fs; let e = new expdesc(); let nvars = 4; /* gen, state, control, plus at least one declared var */ - let base = fs.freereg(); + let base = fs.freereg; /* create control variables */ new_localvarliteral(ls, "(for generator)"); new_localvarliteral(ls, "(for state)"); -- cgit v1.2.3-70-g09d2