|
|
|
@ -1117,7 +1117,8 @@ void luaK_goiftrue (FuncState *fs, expdesc *e) {
|
|
|
|
|
default: {
|
|
|
|
|
if (e->ravi_type == RAVI_TNIL || e->ravi_type == RAVI_TANY || e->ravi_type == RAVI_TBOOLEAN) {
|
|
|
|
|
pc = jumponcond(fs, e, 0); /* jump when false */
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
pc = NO_JUMP; /* always true; do nothing */
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
@ -1147,7 +1148,8 @@ void luaK_goiffalse (FuncState *fs, expdesc *e) {
|
|
|
|
|
default: {
|
|
|
|
|
if (e->ravi_type == RAVI_TNIL) {
|
|
|
|
|
pc = NO_JUMP; /* always false; do nothing */
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
pc = jumponcond(fs, e, 1); /* jump if true */
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
@ -1278,7 +1280,8 @@ static void codeunexpval (FuncState *fs, OpCode op, expdesc *e, int line) {
|
|
|
|
|
e->u.info = luaK_codeABC(fs, OP_LEN, 0, r, 0);
|
|
|
|
|
if (e->ravi_type == RAVI_TARRAYINT || e->ravi_type == RAVI_TARRAYFLT || e->ravi_type == RAVI_TSTRING) {
|
|
|
|
|
e->ravi_type = RAVI_TNUMINT;
|
|
|
|
|
} else if(e->ravi_type == RAVI_TTABLE) {
|
|
|
|
|
}
|
|
|
|
|
else if (e->ravi_type == RAVI_TTABLE) {
|
|
|
|
|
e->k = VRELOCABLE;
|
|
|
|
|
luaK_exp2anyreg(fs, e);
|
|
|
|
|
/* This is not incompatible with lua since a type annotation is require to get here or the table trivially has
|
|
|
|
@ -1652,12 +1655,15 @@ void luaK_posfix (FuncState *fs, BinOpr op,
|
|
|
|
|
if (e1->ravi_type == RAVI_TNIL) {
|
|
|
|
|
/* nil and something is still nil. */
|
|
|
|
|
e2->ravi_type = RAVI_TNIL;
|
|
|
|
|
} else if (e1->ravi_type == RAVI_TBOOLEAN || e1->ravi_type == RAVI_TANY) {
|
|
|
|
|
}
|
|
|
|
|
else if (e1->ravi_type == RAVI_TBOOLEAN || e1->ravi_type == RAVI_TANY) {
|
|
|
|
|
/* In these cases the 'and' can go both ways. */
|
|
|
|
|
if (e2->ravi_type != e1->ravi_type)
|
|
|
|
|
e2->ravi_type = RAVI_TANY;
|
|
|
|
|
} else {
|
|
|
|
|
/* Nothing to do here, since the first arg is always truish and therefore the second arg will be used every time. */
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Nothing to do here, since the first arg is always truish and therefore the second arg will be used every
|
|
|
|
|
* time. */
|
|
|
|
|
}
|
|
|
|
|
*e1 = *e2;
|
|
|
|
|
break;
|
|
|
|
@ -1667,12 +1673,15 @@ void luaK_posfix (FuncState *fs, BinOpr op,
|
|
|
|
|
luaK_dischargevars(fs, e2);
|
|
|
|
|
luaK_concat(fs, &e2->t, e1->t);
|
|
|
|
|
if (e1->ravi_type == RAVI_TNIL) {
|
|
|
|
|
/* Nothing to do here, since the first arg is always truish and therefore the second arg will be used every time. */
|
|
|
|
|
} else if (e1->ravi_type == RAVI_TBOOLEAN || e1->ravi_type == RAVI_TANY) {
|
|
|
|
|
/* Nothing to do here, since the first arg is always truish and therefore the second arg will be used every
|
|
|
|
|
* time. */
|
|
|
|
|
}
|
|
|
|
|
else if (e1->ravi_type == RAVI_TBOOLEAN || e1->ravi_type == RAVI_TANY) {
|
|
|
|
|
/* In these cases the 'or' can go both ways. */
|
|
|
|
|
if (e2->ravi_type != e1->ravi_type)
|
|
|
|
|
e2->ravi_type = RAVI_TANY;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* In this case the first argument is truish and will be the return from 'or' */
|
|
|
|
|
e2->ravi_type = e1->ravi_type;
|
|
|
|
|
}
|
|
|
|
@ -1688,9 +1697,11 @@ void luaK_posfix (FuncState *fs, BinOpr op,
|
|
|
|
|
SETARG_B(getinstruction(fs, e2), e1->u.info);
|
|
|
|
|
DEBUG_CODEGEN(raviY_printf(fs, "[%d]* %o ; set A to %d\n", e2->u.info, getinstruction(fs,e2), e1->u.info));
|
|
|
|
|
e1->k = VRELOCABLE; e1->u.info = e2->u.info;
|
|
|
|
|
if (e2->ravi_type == RAVI_TSTRING && (e1->ravi_type == RAVI_TSTRING || e1->ravi_type == RAVI_TNUMINT || e1->ravi_type == RAVI_TNUMFLT)) {
|
|
|
|
|
if (e2->ravi_type == RAVI_TSTRING &&
|
|
|
|
|
(e1->ravi_type == RAVI_TSTRING || e1->ravi_type == RAVI_TNUMINT || e1->ravi_type == RAVI_TNUMFLT)) {
|
|
|
|
|
e1->ravi_type = RAVI_TSTRING;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
e1->ravi_type = RAVI_TANY;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|