mirror of
https://github.com/lua/lua
synced 2026-09-26 16:17:11 +03:00
Fixed initialization of global variables
When calling 'luaK_storevar', the 'expdesc' for the variable must be created before the one for the expression, to satisfy the assumptions for register allocation. So, in a statement like 'global a = exp', where 'a' is actually '_ENV.a', this variable must be handled before the initializing expression 'exp'.
This commit is contained in:
parent
fca974486d
commit
d4eff00234
3 changed files with 52 additions and 13 deletions
2
lcode.c
2
lcode.c
|
|
@ -1242,7 +1242,7 @@ static void codenot (FuncState *fs, expdesc *e) {
|
|||
** Check whether expression 'e' is a short literal string
|
||||
*/
|
||||
static int isKstr (FuncState *fs, expdesc *e) {
|
||||
return (e->k == VK && !hasjumps(e) && e->u.info <= MAXARG_B &&
|
||||
return (e->k == VK && !hasjumps(e) && e->u.info <= MAXINDEXRK &&
|
||||
ttisshrstring(&fs->f->k[e->u.info]));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue