commit f17e3624ef45212828458c9832306fefb7fc9a6b
parent 2e9b8476cacf008e7313788e55e0b055fa4dee79
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Mon, 18 Apr 2011 16:48:00 -0300
local function name only visible to debug info after being initialized
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lparser.c b/lparser.c
@@ -1,5 +1,5 @@
/*
-** $Id: lparser.c,v 2.106 2011/02/14 16:36:34 roberto Exp roberto $
+** $Id: lparser.c,v 2.107 2011/02/23 13:13:10 roberto Exp roberto $
** Lua Parser
** See Copyright Notice in lua.h
*/
@@ -1391,9 +1391,14 @@ static void ifstat (LexState *ls, int line) {
static void localfunc (LexState *ls) {
expdesc b;
+ FuncState *fs = ls->fs;
+ int varidx = fs->nactvar; /* index of new local variable */
new_localvar(ls, str_checkname(ls)); /* new local variable */
adjustlocalvars(ls, 1); /* enter its scope */
body(ls, &b, 0, ls->linenumber); /* function created in next register */
+ lua_assert(b.k == VNONRELOC && b.u.ind.idx == varidx);
+ /* debug information will only see the variable after this point! */
+ getlocvar(fs, varidx)->startpc = fs->pc;
}