mirror of
https://github.com/lua/lua
synced 2026-09-26 16:17:11 +03:00
Checks for read-only globals
This commit is contained in:
parent
be81209063
commit
4365a45d68
4 changed files with 33 additions and 9 deletions
3
lcode.c
3
lcode.c
|
|
@ -1315,8 +1315,8 @@ void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) {
|
|||
luaK_exp2anyreg(fs, t); /* put it in a register */
|
||||
if (t->k == VUPVAL) {
|
||||
lu_byte temp = cast_byte(t->u.info); /* upvalue index */
|
||||
lua_assert(isKstr(fs, k));
|
||||
t->u.ind.t = temp; /* (can't do a direct assignment; values overlap) */
|
||||
lua_assert(isKstr(fs, k));
|
||||
t->u.ind.idx = cast(short, k->u.info); /* literal short string */
|
||||
t->k = VINDEXUP;
|
||||
}
|
||||
|
|
@ -1336,6 +1336,7 @@ void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) {
|
|||
t->k = VINDEXED;
|
||||
}
|
||||
}
|
||||
t->u.ind.vidx = -1; /* by default, not a declared global */
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue