diff options
Diffstat (limited to 'lua/lparser.c')
-rw-r--r-- | lua/lparser.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lua/lparser.c b/lua/lparser.c index 35fd6d300..81341bf92 100644 --- a/lua/lparser.c +++ b/lua/lparser.c @@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 1.1 2004/03/16 21:58:30 niemeyer Exp $ +** $Id: lparser.c,v 1.2 2004/03/19 21:14:32 niemeyer Exp $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -1141,11 +1141,15 @@ static void ifstat (LexState *ls, int line) { static void localfunc (LexState *ls) { expdesc v, b; + FuncState *fs = ls->fs; new_localvar(ls, str_checkname(ls), 0); - init_exp(&v, VLOCAL, ls->fs->freereg++); + init_exp(&v, VLOCAL, fs->freereg); + luaK_reserveregs(fs, 1); adjustlocalvars(ls, 1); body(ls, &b, 0, ls->linenumber); - luaK_storevar(ls->fs, &v, &b); + luaK_storevar(fs, &v, &b); + /* debug information will only see the variable after this point! */ + getlocvar(fs, fs->nactvar - 1).startpc = fs->pc; } |