Add table.clear().

This commit is contained in:
Mike Pall
2013-11-25 15:18:31 +01:00
parent c378f7dbb8
commit 4593fb5e29
8 changed files with 62 additions and 2 deletions

View File

@@ -1024,6 +1024,16 @@ static void LJ_FASTCALL recff_table_new(jit_State *J, RecordFFData *rd)
UNUSED(rd);
}
static void LJ_FASTCALL recff_table_clear(jit_State *J, RecordFFData *rd)
{
TRef tr = J->base[0];
if (tref_istab(tr)) {
rd->nres = 0;
lj_ir_call(J, IRCALL_lj_tab_clear, tr);
J->needsnap = 1;
} /* else: Interpreter will throw. */
}
/* -- I/O library fast functions ------------------------------------------ */
/* Get FILE* for I/O function. Any I/O error aborts recording, so there's