diff options
-rw-r--r-- | lparser.c | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 2.92 2010/09/07 19:21:39 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.93 2010/12/15 19:13:29 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 | */ |
@@ -368,6 +368,7 @@ static void codeclosure (LexState *ls, Proto *clp, expdesc *v) { | |||
368 | f->p[fs->np++] = clp; | 368 | f->p[fs->np++] = clp; |
369 | luaC_objbarrier(ls->L, f, clp); | 369 | luaC_objbarrier(ls->L, f, clp); |
370 | init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np-1)); | 370 | init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np-1)); |
371 | luaK_exp2nextreg(fs, v); /* fix it at stack top (for GC) */ | ||
371 | } | 372 | } |
372 | 373 | ||
373 | 374 | ||
@@ -1241,14 +1242,10 @@ static void ifstat (LexState *ls, int line) { | |||
1241 | 1242 | ||
1242 | 1243 | ||
1243 | static void localfunc (LexState *ls) { | 1244 | static void localfunc (LexState *ls) { |
1244 | expdesc v, b; | 1245 | expdesc b; |
1245 | FuncState *fs = ls->fs; | 1246 | new_localvar(ls, str_checkname(ls)); /* new local variable */ |
1246 | new_localvar(ls, str_checkname(ls)); | 1247 | adjustlocalvars(ls, 1); /* enter its scope */ |
1247 | init_exp(&v, VLOCAL, fs->freereg); | 1248 | body(ls, &b, 0, ls->linenumber); /* function created in next register */ |
1248 | luaK_reserveregs(fs, 1); | ||
1249 | adjustlocalvars(ls, 1); | ||
1250 | body(ls, &b, 0, ls->linenumber); | ||
1251 | luaK_storevar(fs, &v, &b); | ||
1252 | } | 1249 | } |
1253 | 1250 | ||
1254 | 1251 | ||