diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-06-08 09:29:27 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-06-08 09:29:27 -0300 |
| commit | 0267168675cb21f19e685749e1737dfd2884bdf2 (patch) | |
| tree | f547cfbf519153e4ec37b08fe104eb874f78132f /lcode.c | |
| parent | ba11831d357889ee090ce92ff508957c6c023c42 (diff) | |
| download | lua-github-0267168675cb21f19e685749e1737dfd2884bdf2.tar.gz | |
details.
Diffstat (limited to 'lcode.c')
| -rw-r--r-- | lcode.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -1,5 +1,5 @@ /* -** $Id: lcode.c,v 1.70 2001/06/06 18:00:19 roberto Exp roberto $ +** $Id: lcode.c,v 1.71 2001/06/07 15:01:21 roberto Exp roberto $ ** Code generator for Lua ** See Copyright Notice in lua.h */ @@ -144,6 +144,12 @@ static int need_value (FuncState *fs, int list, OpCode op) { } +static void patchtestreg (Instruction *i, int reg) { + if (reg == NO_REG) reg = GETARG_B(*i); + SETARG_A(*i, reg); +} + + static void luaK_patchlistaux (FuncState *fs, int list, int ttarget, int treg, int ftarget, int freg, int dtarget) { while (list != NO_JUMP) { @@ -151,12 +157,12 @@ static void luaK_patchlistaux (FuncState *fs, int list, Instruction *i = getjumpcontrol(fs, list); switch (GET_OPCODE(*i)) { case OP_TESTT: { - SETARG_A(*i, treg); + patchtestreg(i, treg); luaK_fixjump(fs, list, ttarget); break; } case OP_TESTF: { - SETARG_A(*i, freg); + patchtestreg(i, freg); luaK_fixjump(fs, list, ftarget); break; } |
