diff options
Diffstat (limited to 'lparser.c')
| -rw-r--r-- | lparser.c | 10 |
1 files changed, 5 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lparser.c,v 2.80 2010/03/13 15:55:42 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.81 2010/04/05 16:26:37 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 | */ |
| @@ -288,7 +288,7 @@ static void singlevar (LexState *ls, expdesc *var) { | |||
| 288 | FuncState *fs = ls->fs; | 288 | FuncState *fs = ls->fs; |
| 289 | if (singlevaraux(fs, varname, var, 1) == VVOID) { /* global name? */ | 289 | if (singlevaraux(fs, varname, var, 1) == VVOID) { /* global name? */ |
| 290 | expdesc key; | 290 | expdesc key; |
| 291 | singlevaraux(fs, G(ls->L)->envn, var, 1); /* get _ENV variable */ | 291 | singlevaraux(fs, ls->envn, var, 1); /* get _ENV variable */ |
| 292 | lua_assert(var->k == VLOCAL || var->k == VUPVAL); | 292 | lua_assert(var->k == VLOCAL || var->k == VUPVAL); |
| 293 | codestring(ls, &key, varname); /* key is variable name */ | 293 | codestring(ls, &key, varname); /* key is variable name */ |
| 294 | luaK_indexed(fs, var, &key); /* env[varname] */ | 294 | luaK_indexed(fs, var, &key); /* env[varname] */ |
| @@ -429,12 +429,12 @@ static void close_func (LexState *ls) { | |||
| 429 | ** opens the main function, which is a regular vararg function with an | 429 | ** opens the main function, which is a regular vararg function with an |
| 430 | ** upvalue named '_ENV' | 430 | ** upvalue named '_ENV' |
| 431 | */ | 431 | */ |
| 432 | static void open_mainfunc (lua_State *L, LexState *ls, FuncState *fs) { | 432 | static void open_mainfunc (LexState *ls, FuncState *fs) { |
| 433 | expdesc v; | 433 | expdesc v; |
| 434 | open_func(ls, fs); | 434 | open_func(ls, fs); |
| 435 | fs->f->is_vararg = 1; /* main function is always vararg */ | 435 | fs->f->is_vararg = 1; /* main function is always vararg */ |
| 436 | init_exp(&v, VLOCAL, 0); | 436 | init_exp(&v, VLOCAL, 0); |
| 437 | newupvalue(fs, G(L)->envn, &v); /* create '_ENV' upvalue */ | 437 | newupvalue(fs, ls->envn, &v); /* create '_ENV' upvalue */ |
| 438 | } | 438 | } |
| 439 | 439 | ||
| 440 | 440 | ||
| @@ -448,7 +448,7 @@ Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, Varlist *varl, | |||
| 448 | lexstate.buff = buff; | 448 | lexstate.buff = buff; |
| 449 | lexstate.varl = varl; | 449 | lexstate.varl = varl; |
| 450 | luaX_setinput(L, &lexstate, z, tname); | 450 | luaX_setinput(L, &lexstate, z, tname); |
| 451 | open_mainfunc(L, &lexstate, &funcstate); | 451 | open_mainfunc(&lexstate, &funcstate); |
| 452 | luaX_next(&lexstate); /* read first token */ | 452 | luaX_next(&lexstate); /* read first token */ |
| 453 | chunk(&lexstate); /* read main chunk */ | 453 | chunk(&lexstate); /* read main chunk */ |
| 454 | check(&lexstate, TK_EOS); | 454 | check(&lexstate, TK_EOS); |
