bug: label between local definitions can mix-up their initializations

This commit is contained in:
Roberto Ierusalimschy
2016-03-07 16:25:39 -03:00
parent 03ca6385dc
commit e7b2e01d43
2 changed files with 35 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lparser.c,v 2.150 2015/12/09 15:21:28 roberto Exp roberto $
** $Id: lparser.c,v 2.151 2016/01/05 16:22:37 roberto Exp roberto $
** Lua Parser
** See Copyright Notice in lua.h
*/
@@ -1230,7 +1230,7 @@ static void labelstat (LexState *ls, TString *label, int line) {
checkrepeated(fs, ll, label); /* check for repeated labels */
checknext(ls, TK_DBCOLON); /* skip double colon */
/* create new entry for this label */
l = newlabelentry(ls, ll, label, line, fs->pc);
l = newlabelentry(ls, ll, label, line, luaK_getlabel(fs));
skipnoopstat(ls); /* skip other no-op statements */
if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */
/* assume that locals are already out of scope */