diff options
Diffstat (limited to 'lcode.c')
| -rw-r--r-- | lcode.c | 10 |
1 files changed, 6 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lcode.c,v 1.116 2003/02/27 12:33:07 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 1.117 2003/04/03 13:35:34 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 | */ |
| @@ -88,7 +88,7 @@ static int luaK_getjump (FuncState *fs, int pc) { | |||
| 88 | 88 | ||
| 89 | static Instruction *getjumpcontrol (FuncState *fs, int pc) { | 89 | static Instruction *getjumpcontrol (FuncState *fs, int pc) { |
| 90 | Instruction *pi = &fs->f->code[pc]; | 90 | Instruction *pi = &fs->f->code[pc]; |
| 91 | if (pc >= 1 && testOpMode(GET_OPCODE(*(pi-1)), OpModeT)) | 91 | if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1)))) |
| 92 | return pi-1; | 92 | return pi-1; |
| 93 | else | 93 | else |
| 94 | return pi; | 94 | return pi; |
| @@ -462,8 +462,7 @@ void luaK_self (FuncState *fs, expdesc *e, expdesc *key) { | |||
| 462 | 462 | ||
| 463 | static void invertjump (FuncState *fs, expdesc *e) { | 463 | static void invertjump (FuncState *fs, expdesc *e) { |
| 464 | Instruction *pc = getjumpcontrol(fs, e->info); | 464 | Instruction *pc = getjumpcontrol(fs, e->info); |
| 465 | lua_assert(testOpMode(GET_OPCODE(*pc), OpModeT) && | 465 | lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TEST); |
| 466 | GET_OPCODE(*pc) != OP_TEST); | ||
| 467 | SETARG_A(*pc, !(GETARG_A(*pc))); | 466 | SETARG_A(*pc, !(GETARG_A(*pc))); |
| 468 | } | 467 | } |
| 469 | 468 | ||
| @@ -703,12 +702,15 @@ int luaK_code (FuncState *fs, Instruction i, int line) { | |||
| 703 | 702 | ||
| 704 | int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) { | 703 | int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) { |
| 705 | lua_assert(getOpMode(o) == iABC); | 704 | lua_assert(getOpMode(o) == iABC); |
| 705 | lua_assert(getBMode(o) != OpArgN || b == 0); | ||
| 706 | lua_assert(getCMode(o) != OpArgN || c == 0); | ||
| 706 | return luaK_code(fs, CREATE_ABC(o, a, b, c), fs->ls->lastline); | 707 | return luaK_code(fs, CREATE_ABC(o, a, b, c), fs->ls->lastline); |
| 707 | } | 708 | } |
| 708 | 709 | ||
| 709 | 710 | ||
| 710 | int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { | 711 | int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { |
| 711 | lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx); | 712 | lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx); |
| 713 | lua_assert(getCMode(o) == OpArgN); | ||
| 712 | return luaK_code(fs, CREATE_ABx(o, a, bc), fs->ls->lastline); | 714 | return luaK_code(fs, CREATE_ABx(o, a, bc), fs->ls->lastline); |
| 713 | } | 715 | } |
| 714 | 716 | ||
