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:
Roberto I
2025-10-29 13:14:48 -03:00
parent fca974486d
commit d4eff00234
3 changed files with 52 additions and 13 deletions

View File

@@ -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]));
}