aboutsummaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/lcode.c b/lcode.c
index 23969a69..b0edeafe 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lcode.c,v 2.49 2010/07/07 16:27:29 roberto Exp roberto $ 2** $Id: lcode.c,v 2.50 2011/01/31 14:28:41 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*/
@@ -171,6 +171,19 @@ void luaK_patchlist (FuncState *fs, int list, int target) {
171} 171}
172 172
173 173
174LUAI_FUNC void luaK_patchclose (FuncState *fs, int list, int level) {
175 level++; /* argument is +1 to reserve 0 as non-op */
176 while (list != NO_JUMP) {
177 int next = getjump(fs, list);
178 lua_assert(GET_OPCODE(fs->f->code[list]) == OP_JMP &&
179 (GETARG_A(fs->f->code[list]) == 0 ||
180 GETARG_A(fs->f->code[list]) >= level));
181 SETARG_A(fs->f->code[list], level);
182 list = next;
183 }
184}
185
186
174void luaK_patchtohere (FuncState *fs, int list) { 187void luaK_patchtohere (FuncState *fs, int list) {
175 luaK_getlabel(fs); 188 luaK_getlabel(fs);
176 luaK_concat(fs, &fs->jpc, list); 189 luaK_concat(fs, &fs->jpc, list);