567c849b4c
Resolves: #2074542
23 lines
852 B
Diff
23 lines
852 B
Diff
From 1f3c6f4534c6411313361697d98d1145a1f030fa Mon Sep 17 00:00:00 2001
|
|
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
|
|
Date: Tue, 15 Feb 2022 12:28:46 -0300
|
|
Subject: [PATCH] Bug: Lua can generate wrong code when _ENV is <const>
|
|
|
|
---
|
|
lparser.c | 1 +
|
|
testes/attrib.lua | 10 ++++++++++
|
|
2 files changed, 11 insertions(+)
|
|
|
|
diff --git a/lparser.c b/lparser.c
|
|
index 3abe3d751..a5cd55257 100644
|
|
--- a/src/lparser.c
|
|
+++ b/src/lparser.c
|
|
@@ -468,6 +468,7 @@ static void singlevar (LexState *ls, expdesc *var) {
|
|
expdesc key;
|
|
singlevaraux(fs, ls->envn, var, 1); /* get environment variable */
|
|
lua_assert(var->k != VVOID); /* this one must exist */
|
|
+ luaK_exp2anyregup(fs, var); /* but could be a constant */
|
|
codestring(&key, varname); /* key is variable name */
|
|
luaK_indexed(fs, var, &key); /* env[varname] */
|
|
}
|