|
|
@ -668,13 +668,16 @@ static void ravi_code_typecoersion(LexState *ls, int reg, ravi_type_map tm,
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void ravi_code_setzero(FuncState *fs, int reg, ravi_type_map ravi_type, TString *usertype) {
|
|
|
|
static void ravi_code_setzero(FuncState *fs, int reg, ravi_type_map ravi_type, TString *usertype) {
|
|
|
|
(void) usertype;
|
|
|
|
(void) usertype;
|
|
|
|
if (ravi_type == RAVI_TM_FLOAT || ravi_type == RAVI_TM_INTEGER)
|
|
|
|
if (ravi_type == RAVI_TM_FLOAT || ravi_type == RAVI_TM_INTEGER)
|
|
|
|
/* code an instruction to convert in place */
|
|
|
|
/* code an instruction to convert in place */
|
|
|
|
luaK_codeABC(fs, ravi_type == RAVI_TM_FLOAT ? OP_RAVI_LOADFZ : OP_RAVI_LOADIZ, reg, 0, 0);
|
|
|
|
luaK_codeABC(fs, ravi_type == RAVI_TM_FLOAT ? OP_RAVI_LOADFZ : OP_RAVI_LOADIZ, reg, 0, 0);
|
|
|
|
|
|
|
|
else if (ravi_type == RAVI_TM_BOOLEAN)
|
|
|
|
|
|
|
|
luaK_codeABC(fs, OP_LOADBOOL, reg, 0, 0);
|
|
|
|
|
|
|
|
else if (ravi_type == RAVI_TM_STRING)
|
|
|
|
|
|
|
|
luaK_codeABC(fs, OP_LOADNIL, reg, 0, 0);
|
|
|
|
else if ((ravi_type & RAVI_TM_NIL) == 0) {
|
|
|
|
else if ((ravi_type & RAVI_TM_NIL) == 0) {
|
|
|
|
char type_map_str[RAVI_TYPEMAP_MAX_LEN];
|
|
|
|
char type_map_str[RAVI_TYPEMAP_MAX_LEN];
|
|
|
|
raviY_typemap_string(ravi_type, type_map_str);
|
|
|
|
raviY_typemap_string(ravi_type, type_map_str);
|
|
|
|
|
|
|
|
|
|
|
|
luaX_syntaxerror(fs->ls, luaO_pushfstring(fs->ls->L, "uninitialized %s in local variable", type_map_str));
|
|
|
|
luaX_syntaxerror(fs->ls, luaO_pushfstring(fs->ls->L, "uninitialized %s in local variable", type_map_str));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|