aboutsummaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
authorRoberto I <roberto@inf.puc-rio.br>2025-10-29 13:14:48 -0300
committerRoberto I <roberto@inf.puc-rio.br>2025-10-29 13:14:48 -0300
commitd4eff00234dc55dac4cb86b6187f5607c1254f9b (patch)
tree3f080f35cfd23249166a4311946cf0ea766d71d0 /lcode.c
parentfca974486d12aa29bb6d731fdb5b25055157ece8 (diff)
downloadlua-d4eff00234dc55dac4cb86b6187f5607c1254f9b.tar.gz
lua-d4eff00234dc55dac4cb86b6187f5607c1254f9b.tar.bz2
lua-d4eff00234dc55dac4cb86b6187f5607c1254f9b.zip
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'.
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lcode.c b/lcode.c
index 429d4f80..7c63abb2 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1242,7 +1242,7 @@ static void codenot (FuncState *fs, expdesc *e) {
1242** Check whether expression 'e' is a short literal string 1242** Check whether expression 'e' is a short literal string
1243*/ 1243*/
1244static int isKstr (FuncState *fs, expdesc *e) { 1244static int isKstr (FuncState *fs, expdesc *e) {
1245 return (e->k == VK && !hasjumps(e) && e->u.info <= MAXARG_B && 1245 return (e->k == VK && !hasjumps(e) && e->u.info <= MAXINDEXRK &&
1246 ttisshrstring(&fs->f->k[e->u.info])); 1246 ttisshrstring(&fs->f->k[e->u.info]));
1247} 1247}
1248 1248