Clearer distinction between types and tags

LUA_T* represents only types; tags (types + Variants) are represented
by LUA_V* constants.
This commit is contained in:
Roberto Ierusalimschy
2020-01-31 11:09:53 -03:00
parent 69c7139ff8
commit 46c3587a6f
22 changed files with 231 additions and 213 deletions

12
lcode.c
View File

@@ -678,22 +678,22 @@ static void luaK_float (FuncState *fs, int reg, lua_Number f) {
*/
static void const2exp (TValue *v, expdesc *e) {
switch (ttypetag(v)) {
case LUA_TNUMINT:
case LUA_VNUMINT:
e->k = VKINT; e->u.ival = ivalue(v);
break;
case LUA_TNUMFLT:
case LUA_VNUMFLT:
e->k = VKFLT; e->u.nval = fltvalue(v);
break;
case LUA_TFALSE:
case LUA_VFALSE:
e->k = VFALSE;
break;
case LUA_TTRUE:
case LUA_VTRUE:
e->k = VTRUE;
break;
case LUA_TNIL:
case LUA_VNIL:
e->k = VNIL;
break;
case LUA_TSHRSTR: case LUA_TLNGSTR:
case LUA_VSHRSTR: case LUA_VLNGSTR:
e->k = VKSTR; e->u.strval = tsvalue(v);
break;
default: lua_assert(0);