test for 'fs' being NULL at the end of 'close_func' is useless ('fs'
cannot be NULl and the new ls->fs can only be NULL when the token is EOS, in which case anchor_token has no effect).
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lparser.c,v 2.63 2009/06/10 16:52:03 roberto Exp roberto $
|
** $Id: lparser.c,v 2.64 2009/06/18 16:35:05 roberto Exp roberto $
|
||||||
** Lua Parser
|
** Lua Parser
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -55,6 +55,8 @@ static void expr (LexState *ls, expdesc *v);
|
|||||||
|
|
||||||
|
|
||||||
static void anchor_token (LexState *ls) {
|
static void anchor_token (LexState *ls) {
|
||||||
|
/* last token from outer function must be EOS */
|
||||||
|
lua_assert(ls->fs != NULL || ls->t.token == TK_EOS);
|
||||||
if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) {
|
if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) {
|
||||||
TString *ts = ls->t.seminfo.ts;
|
TString *ts = ls->t.seminfo.ts;
|
||||||
luaX_newstring(ls, getstr(ts), ts->tsv.len);
|
luaX_newstring(ls, getstr(ts), ts->tsv.len);
|
||||||
@@ -380,7 +382,7 @@ static void close_func (LexState *ls) {
|
|||||||
ls->fs = fs->prev;
|
ls->fs = fs->prev;
|
||||||
L->top -= 2; /* remove table and prototype from the stack */
|
L->top -= 2; /* remove table and prototype from the stack */
|
||||||
/* last token read was anchored in defunct function; must reanchor it */
|
/* last token read was anchored in defunct function; must reanchor it */
|
||||||
if (fs) anchor_token(ls);
|
anchor_token(ls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user