FFI: Check for __new metamethod when calling a constructor.

This commit is contained in:
Mike Pall
2012-06-20 18:24:49 +02:00
parent e9e45313e7
commit 8b71ab1080
4 changed files with 65 additions and 44 deletions

View File

@@ -437,6 +437,12 @@ enum {
#define setvmstate(g, st) ((g)->vmstate = ~LJ_VMST_##st)
/* Metamethods. ORDER MM */
#ifdef LJ_HASFFI
#define MMDEF_FFI(_) _(new)
#else
#define MMDEF_FFI(_)
#endif
#ifdef LUAJIT_ENABLE_LUA52COMPAT
#define MMDEF_52(_) _(pairs) _(ipairs)
#else
@@ -450,7 +456,7 @@ enum {
/* The following must be in ORDER ARITH. */ \
_(add) _(sub) _(mul) _(div) _(mod) _(pow) _(unm) \
/* The following are used in the standard libraries. */ \
_(metatable) _(tostring) MMDEF_52(_)
_(metatable) _(tostring) MMDEF_FFI(_) MMDEF_52(_)
typedef enum {
#define MMENUM(name) MM_##name,