diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-10-18 09:01:52 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-10-18 09:01:52 -0200 |
commit | 4eef0aaad19cb442fc7b103eda9a249aa4c0ecef (patch) | |
tree | e1abf3d3326b052e45274f50138dc88ce16a5140 | |
parent | ab09732986d551efea3f44367ec1221afea72c7d (diff) | |
download | lua-4eef0aaad19cb442fc7b103eda9a249aa4c0ecef.tar.gz lua-4eef0aaad19cb442fc7b103eda9a249aa4c0ecef.tar.bz2 lua-4eef0aaad19cb442fc7b103eda9a249aa4c0ecef.zip |
detail
-rw-r--r-- | lparser.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 2.53 2007/05/11 17:28:56 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.54 2007/07/31 19:39:52 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 | */ |
@@ -175,8 +175,7 @@ static void adjustlocalvars (LexState *ls, int nvars) { | |||
175 | } | 175 | } |
176 | 176 | ||
177 | 177 | ||
178 | static void removevars (LexState *ls, int tolevel) { | 178 | static void removevars (FuncState *fs, int tolevel) { |
179 | FuncState *fs = ls->fs; | ||
180 | while (fs->nactvar > tolevel) | 179 | while (fs->nactvar > tolevel) |
181 | getlocvar(fs, --fs->nactvar).endpc = fs->pc; | 180 | getlocvar(fs, --fs->nactvar).endpc = fs->pc; |
182 | } | 181 | } |
@@ -299,7 +298,7 @@ static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) { | |||
299 | static void leaveblock (FuncState *fs) { | 298 | static void leaveblock (FuncState *fs) { |
300 | BlockCnt *bl = fs->bl; | 299 | BlockCnt *bl = fs->bl; |
301 | fs->bl = bl->previous; | 300 | fs->bl = bl->previous; |
302 | removevars(fs->ls, bl->nactvar); | 301 | removevars(fs, bl->nactvar); |
303 | if (bl->upval) | 302 | if (bl->upval) |
304 | luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); | 303 | luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); |
305 | /* a block either controls scope or breaks (never both) */ | 304 | /* a block either controls scope or breaks (never both) */ |
@@ -362,7 +361,7 @@ static void close_func (LexState *ls) { | |||
362 | lua_State *L = ls->L; | 361 | lua_State *L = ls->L; |
363 | FuncState *fs = ls->fs; | 362 | FuncState *fs = ls->fs; |
364 | Proto *f = fs->f; | 363 | Proto *f = fs->f; |
365 | removevars(ls, 0); | 364 | removevars(fs, 0); |
366 | luaK_ret(fs, 0, 0); /* final return */ | 365 | luaK_ret(fs, 0, 0); /* final return */ |
367 | luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction); | 366 | luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction); |
368 | f->sizecode = fs->pc; | 367 | f->sizecode = fs->pc; |