diff options
Diffstat (limited to 'lcode.c')
-rw-r--r-- | lcode.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1215,7 +1215,7 @@ static void codenot (FuncState *fs, expdesc *e) { | |||
1215 | 1215 | ||
1216 | 1216 | ||
1217 | /* | 1217 | /* |
1218 | ** Check whether expression 'e' is a small literal string | 1218 | ** Check whether expression 'e' is a short literal string |
1219 | */ | 1219 | */ |
1220 | static int isKstr (FuncState *fs, expdesc *e) { | 1220 | static int isKstr (FuncState *fs, expdesc *e) { |
1221 | return (e->k == VK && !hasjumps(e) && e->u.info <= MAXARG_B && | 1221 | return (e->k == VK && !hasjumps(e) && e->u.info <= MAXARG_B && |
@@ -1283,15 +1283,16 @@ void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { | |||
1283 | if (t->k == VUPVAL && !isKstr(fs, k)) /* upvalue indexed by non 'Kstr'? */ | 1283 | if (t->k == VUPVAL && !isKstr(fs, k)) /* upvalue indexed by non 'Kstr'? */ |
1284 | luaK_exp2anyreg(fs, t); /* put it in a register */ | 1284 | luaK_exp2anyreg(fs, t); /* put it in a register */ |
1285 | if (t->k == VUPVAL) { | 1285 | if (t->k == VUPVAL) { |
1286 | lua_assert(isKstr(fs, k)); | ||
1286 | t->u.ind.t = t->u.info; /* upvalue index */ | 1287 | t->u.ind.t = t->u.info; /* upvalue index */ |
1287 | t->u.ind.idx = k->u.info; /* literal string */ | 1288 | t->u.ind.idx = k->u.info; /* literal short string */ |
1288 | t->k = VINDEXUP; | 1289 | t->k = VINDEXUP; |
1289 | } | 1290 | } |
1290 | else { | 1291 | else { |
1291 | /* register index of the table */ | 1292 | /* register index of the table */ |
1292 | t->u.ind.t = (t->k == VLOCAL) ? t->u.var.ridx: t->u.info; | 1293 | t->u.ind.t = (t->k == VLOCAL) ? t->u.var.ridx: t->u.info; |
1293 | if (isKstr(fs, k)) { | 1294 | if (isKstr(fs, k)) { |
1294 | t->u.ind.idx = k->u.info; /* literal string */ | 1295 | t->u.ind.idx = k->u.info; /* literal short string */ |
1295 | t->k = VINDEXSTR; | 1296 | t->k = VINDEXSTR; |
1296 | } | 1297 | } |
1297 | else if (isCint(k)) { | 1298 | else if (isCint(k)) { |