diff options
Diffstat (limited to 'lcode.c')
-rw-r--r-- | lcode.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1673,13 +1673,13 @@ void luaK_finish (FuncState *fs) { | |||
1673 | lua_assert(i == 0 || isOT(*(pc - 1)) == isIT(*pc)); | 1673 | lua_assert(i == 0 || isOT(*(pc - 1)) == isIT(*pc)); |
1674 | switch (GET_OPCODE(*pc)) { | 1674 | switch (GET_OPCODE(*pc)) { |
1675 | case OP_RETURN0: case OP_RETURN1: { | 1675 | case OP_RETURN0: case OP_RETURN1: { |
1676 | if (p->sizep == 0 && !p->is_vararg) | 1676 | if (!(fs->needclose || p->is_vararg)) |
1677 | break; /* no extra work */ | 1677 | break; /* no extra work */ |
1678 | /* else use OP_RETURN to do the extra work */ | 1678 | /* else use OP_RETURN to do the extra work */ |
1679 | SET_OPCODE(*pc, OP_RETURN); | 1679 | SET_OPCODE(*pc, OP_RETURN); |
1680 | } /* FALLTHROUGH */ | 1680 | } /* FALLTHROUGH */ |
1681 | case OP_RETURN: case OP_TAILCALL: { | 1681 | case OP_RETURN: case OP_TAILCALL: { |
1682 | if (p->sizep > 0 || p->is_vararg) { | 1682 | if (fs->needclose || p->is_vararg) { |
1683 | SETARG_C(*pc, p->is_vararg ? p->numparams + 1 : 0); | 1683 | SETARG_C(*pc, p->is_vararg ? p->numparams + 1 : 0); |
1684 | SETARG_k(*pc, 1); /* signal that there is extra work */ | 1684 | SETARG_k(*pc, 1); /* signal that there is extra work */ |
1685 | } | 1685 | } |