aboutsummaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/lcode.c b/lcode.c
index 853cffe2..96ef6b96 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lcode.c,v 2.33 2007/03/27 14:11:38 roberto Exp roberto $ 2** $Id: lcode.c,v 2.34 2007/05/04 18:41:49 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*/
@@ -824,16 +824,24 @@ int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) {
824} 824}
825 825
826 826
827static int luaK_codeAx (FuncState *fs, OpCode o, int a) {
828 lua_assert(getOpMode(o) == iAx);
829 return luaK_code(fs, CREATE_Ax(o, a));
830}
831
832
827void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { 833void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) {
828 int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1; 834 int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1;
829 int b = (tostore == LUA_MULTRET) ? 0 : tostore; 835 int b = (tostore == LUA_MULTRET) ? 0 : tostore;
830 lua_assert(tostore != 0); 836 lua_assert(tostore != 0);
831 if (c <= MAXARG_C) 837 if (c <= MAXARG_C)
832 luaK_codeABC(fs, OP_SETLIST, base, b, c); 838 luaK_codeABC(fs, OP_SETLIST, base, b, c);
833 else { 839 else if (c <= MAXARG_Ax) {
834 luaK_codeABC(fs, OP_SETLIST, base, b, 0); 840 luaK_codeABC(fs, OP_SETLIST, base, b, 0);
835 luaK_code(fs, cast(Instruction, c)); 841 luaK_codeAx(fs, OP_EXTRAARG, c);
836 } 842 }
843 else
844 luaX_syntaxerror(fs->ls, "constructor too long");
837 fs->freereg = base + 1; /* free registers with list values */ 845 fs->freereg = base + 1; /* free registers with list values */
838} 846}
839 847