aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lparser.c1
-rw-r--r--testes/attrib.lua10
2 files changed, 11 insertions, 0 deletions
diff --git a/lparser.c b/lparser.c
index 3abe3d75..a5cd5525 100644
--- a/lparser.c
+++ b/lparser.c
@@ -468,6 +468,7 @@ static void singlevar (LexState *ls, expdesc *var) {
468 expdesc key; 468 expdesc key;
469 singlevaraux(fs, ls->envn, var, 1); /* get environment variable */ 469 singlevaraux(fs, ls->envn, var, 1); /* get environment variable */
470 lua_assert(var->k != VVOID); /* this one must exist */ 470 lua_assert(var->k != VVOID); /* this one must exist */
471 luaK_exp2anyregup(fs, var); /* but could be a constant */
471 codestring(&key, varname); /* key is variable name */ 472 codestring(&key, varname); /* key is variable name */
472 luaK_indexed(fs, var, &key); /* env[varname] */ 473 luaK_indexed(fs, var, &key); /* env[varname] */
473 } 474 }
diff --git a/testes/attrib.lua b/testes/attrib.lua
index b1076c76..83821c06 100644
--- a/testes/attrib.lua
+++ b/testes/attrib.lua
@@ -434,6 +434,16 @@ a.aVeryLongName012345678901234567890123456789012345678901234567890123456789 ==
43410) 43410)
435 435
436 436
437do
438 -- _ENV constant
439 local function foo ()
440 local _ENV <const> = 11
441 X = "hi"
442 end
443 local st, msg = pcall(foo)
444 assert(not st and string.find(msg, "number"))
445end
446
437 447
438-- test of large float/integer indices 448-- test of large float/integer indices
439 449