diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-08-10 17:41:04 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-08-10 17:41:04 -0300 |
| commit | 4e1ffc482a7eadde2cace3102a8d22c5baa4d7a9 (patch) | |
| tree | b4502238b62f16078df309c2c667fd03220d2cdb | |
| parent | bc439e21cd262af69ae5988b3c0067e87d9b9230 (diff) | |
| download | lua-4e1ffc482a7eadde2cace3102a8d22c5baa4d7a9.tar.gz lua-4e1ffc482a7eadde2cace3102a8d22c5baa4d7a9.tar.bz2 lua-4e1ffc482a7eadde2cace3102a8d22c5baa4d7a9.zip | |
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).
| -rw-r--r-- | lparser.c | 6 |
1 files changed, 4 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lparser.c,v 2.63 2009/06/10 16:52:03 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.64 2009/06/18 16:35:05 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 | */ |
| @@ -55,6 +55,8 @@ static void expr (LexState *ls, expdesc *v); | |||
| 55 | 55 | ||
| 56 | 56 | ||
| 57 | static void anchor_token (LexState *ls) { | 57 | static void anchor_token (LexState *ls) { |
| 58 | /* last token from outer function must be EOS */ | ||
| 59 | lua_assert(ls->fs != NULL || ls->t.token == TK_EOS); | ||
| 58 | if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) { | 60 | if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) { |
| 59 | TString *ts = ls->t.seminfo.ts; | 61 | TString *ts = ls->t.seminfo.ts; |
| 60 | luaX_newstring(ls, getstr(ts), ts->tsv.len); | 62 | luaX_newstring(ls, getstr(ts), ts->tsv.len); |
| @@ -380,7 +382,7 @@ static void close_func (LexState *ls) { | |||
| 380 | ls->fs = fs->prev; | 382 | ls->fs = fs->prev; |
| 381 | L->top -= 2; /* remove table and prototype from the stack */ | 383 | L->top -= 2; /* remove table and prototype from the stack */ |
| 382 | /* last token read was anchored in defunct function; must reanchor it */ | 384 | /* last token read was anchored in defunct function; must reanchor it */ |
| 383 | if (fs) anchor_token(ls); | 385 | anchor_token(ls); |
| 384 | } | 386 | } |
| 385 | 387 | ||
| 386 | 388 | ||
