diff options
Diffstat (limited to 'lparser.c')
-rw-r--r-- | lparser.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 2.96 2011/02/01 18:03:10 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.97 2011/02/04 17:34:43 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -429,8 +429,12 @@ static void leaveblock (FuncState *fs) { | |||
429 | removevars(fs, bl->nactvar); | 429 | removevars(fs, bl->nactvar); |
430 | fs->ls->labell->nlabel = bl->firstlabel; /* remove local labels */ | 430 | fs->ls->labell->nlabel = bl->firstlabel; /* remove local labels */ |
431 | movegotosout(fs, bl); | 431 | movegotosout(fs, bl); |
432 | if (bl->upval) | 432 | if (bl->upval) { |
433 | luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); | 433 | /* create a 'jump to here' to close upvalues */ |
434 | int j = luaK_jump(fs); | ||
435 | luaK_patchclose(fs, j, bl->nactvar); | ||
436 | luaK_patchtohere(fs, j); | ||
437 | } | ||
434 | /* a block either controls scope or breaks (never both) */ | 438 | /* a block either controls scope or breaks (never both) */ |
435 | lua_assert(!bl->isbreakable || !bl->upval); | 439 | lua_assert(!bl->isbreakable || !bl->upval); |
436 | lua_assert(bl->nactvar == fs->nactvar); | 440 | lua_assert(bl->nactvar == fs->nactvar); |