pull/81/head
Dibyendu Majumdar 9 years ago
parent b44d456ea7
commit f209f76876

@ -73,7 +73,7 @@ typedef LUAI_UACNUMBER l_uacNumber;
typedef LUAI_UACINT l_uacInt;
#ifndef lua_assert
//#undef NDEBUG
#undef NDEBUG
#include <assert.h>
#define lua_assert assert

@ -390,7 +390,7 @@ typedef union UUdata {
**/
typedef enum {
RAVI_TANY = -1, /* Lua dynamic type */
RAVI_TNUMINT, /* integer number */
RAVI_TNUMINT = 1, /* integer number */
RAVI_TNUMFLT, /* floating point number */
RAVI_TARRAYINT, /* array of ints */
RAVI_TARRAYFLT, /* array of doubles */

@ -884,6 +884,16 @@ void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) {
t->u.ind.vt = (t->k == VUPVAL) ? VUPVAL
: check_exp(vkisinreg(t->k), VLOCAL);
t->k = VINDEXED;
/*
RAVI - when parsing something like (10)[3] - t->ravi_type is RAVI_TNUMINT
which is wrong so we need to check for this situation. Problem is that
because of metatables the index [] operator can even be applied to numeric
values (see for example Lua test events.lua line 1114). It feels wrong to
have to change it here ... needs to investigated further as there may be
a defect elsewhere.
*/
if (t->ravi_type != RAVI_TTABLE && t->ravi_type != RAVI_TARRAYFLT && t->ravi_type != RAVI_TARRAYINT)
t->ravi_type = RAVI_TANY;
}

Loading…
Cancel
Save