aboutsummaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lcode.c b/lcode.c
index 04b534e2..521f597a 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lcode.c,v 2.145 2017/12/15 18:53:48 roberto Exp roberto $ 2** $Id: lcode.c,v 2.146 2017/12/18 15:44:44 roberto Exp roberto $
3** Code generator for Lua 3** Code generator for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -618,12 +618,11 @@ static void luaK_float (FuncState *fs, int reg, lua_Number f) {
618** or 'nresults' is LUA_MULTRET (as any expression can satisfy that). 618** or 'nresults' is LUA_MULTRET (as any expression can satisfy that).
619*/ 619*/
620void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { 620void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) {
621 if (e->k == VCALL) { /* expression is an open function call? */ 621 Instruction *pc = &getinstruction(fs, e);
622 SETARG_C(getinstruction(fs, e), nresults + 1); 622 if (e->k == VCALL) /* expression is an open function call? */
623 } 623 SETARG_C(*pc, nresults + 1);
624 else if (e->k == VVARARG) { 624 else if (e->k == VVARARG) {
625 Instruction *pc = &getinstruction(fs, e); 625 SETARG_C(*pc, nresults + 1);
626 SETARG_B(*pc, nresults + 1);
627 SETARG_A(*pc, fs->freereg); 626 SETARG_A(*pc, fs->freereg);
628 luaK_reserveregs(fs, 1); 627 luaK_reserveregs(fs, 1);
629 } 628 }
@@ -649,7 +648,7 @@ void luaK_setoneret (FuncState *fs, expdesc *e) {
649 e->u.info = GETARG_A(getinstruction(fs, e)); 648 e->u.info = GETARG_A(getinstruction(fs, e));
650 } 649 }
651 else if (e->k == VVARARG) { 650 else if (e->k == VVARARG) {
652 SETARG_B(getinstruction(fs, e), 2); 651 SETARG_C(getinstruction(fs, e), 2);
653 e->k = VRELOC; /* can relocate its simple result */ 652 e->k = VRELOC; /* can relocate its simple result */
654 } 653 }
655} 654}
@@ -1623,6 +1622,7 @@ void luaK_finish (FuncState *fs) {
1623 Proto *p = fs->f; 1622 Proto *p = fs->f;
1624 for (i = 0; i < fs->pc; i++) { 1623 for (i = 0; i < fs->pc; i++) {
1625 Instruction *pc = &p->code[i]; 1624 Instruction *pc = &p->code[i];
1625 lua_assert(isOT(*pc) == isIT(*(pc + 1)));
1626 switch (GET_OPCODE(*pc)) { 1626 switch (GET_OPCODE(*pc)) {
1627 case OP_RETURN: case OP_RETURN0: case OP_RETURN1: 1627 case OP_RETURN: case OP_RETURN0: case OP_RETURN1:
1628 case OP_TAILCALL: { 1628 case OP_TAILCALL: {