diff options
Diffstat (limited to 'lcode.c')
-rw-r--r-- | lcode.c | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -208,8 +208,7 @@ void luaK_ret (FuncState *fs, int first, int nret) { | |||
208 | case 1: op = OP_RETURN1; break; | 208 | case 1: op = OP_RETURN1; break; |
209 | default: op = OP_RETURN; break; | 209 | default: op = OP_RETURN; break; |
210 | } | 210 | } |
211 | if (nret + 1 > MAXARG_B) | 211 | luaY_checklimit(fs, nret + 1, MAXARG_B, "returns"); |
212 | luaX_syntaxerror(fs->ls, "too many returns"); | ||
213 | luaK_codeABC(fs, op, first, nret + 1, 0); | 212 | luaK_codeABC(fs, op, first, nret + 1, 0); |
214 | } | 213 | } |
215 | 214 | ||
@@ -473,9 +472,7 @@ static int luaK_codek (FuncState *fs, int reg, int k) { | |||
473 | void luaK_checkstack (FuncState *fs, int n) { | 472 | void luaK_checkstack (FuncState *fs, int n) { |
474 | int newstack = fs->freereg + n; | 473 | int newstack = fs->freereg + n; |
475 | if (newstack > fs->f->maxstacksize) { | 474 | if (newstack > fs->f->maxstacksize) { |
476 | if (newstack > MAX_FSTACK) | 475 | luaY_checklimit(fs, newstack, MAX_FSTACK, "registers"); |
477 | luaX_syntaxerror(fs->ls, | ||
478 | "function or expression needs too many registers"); | ||
479 | fs->f->maxstacksize = cast_byte(newstack); | 476 | fs->f->maxstacksize = cast_byte(newstack); |
480 | } | 477 | } |
481 | } | 478 | } |
@@ -727,8 +724,7 @@ static void const2exp (TValue *v, expdesc *e) { | |||
727 | */ | 724 | */ |
728 | void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { | 725 | void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { |
729 | Instruction *pc = &getinstruction(fs, e); | 726 | Instruction *pc = &getinstruction(fs, e); |
730 | if (nresults + 1 > MAXARG_C) | 727 | luaY_checklimit(fs, nresults + 1, MAXARG_C, "multiple results"); |
731 | luaX_syntaxerror(fs->ls, "too many multiple results"); | ||
732 | if (e->k == VCALL) /* expression is an open function call? */ | 728 | if (e->k == VCALL) /* expression is an open function call? */ |
733 | SETARG_C(*pc, nresults + 1); | 729 | SETARG_C(*pc, nresults + 1); |
734 | else { | 730 | else { |