FFI: Always resolve metamethods for pointers to structs.
This commit is contained in:
@@ -218,10 +218,18 @@ static int carith_int64(lua_State *L, CTState *cts, CDArith *ca, MMS mm)
|
||||
static int lj_carith_meta(lua_State *L, CTState *cts, CDArith *ca, MMS mm)
|
||||
{
|
||||
cTValue *tv = NULL;
|
||||
if (tviscdata(L->base))
|
||||
tv = lj_ctype_meta(cts, cdataV(L->base)->ctypeid, mm);
|
||||
if (!tv && L->base+1 < L->top && tviscdata(L->base+1))
|
||||
tv = lj_ctype_meta(cts, cdataV(L->base+1)->ctypeid, mm);
|
||||
if (tviscdata(L->base)) {
|
||||
CTypeID id = cdataV(L->base)->ctypeid;
|
||||
CType *ct = ctype_raw(cts, id);
|
||||
if (ctype_isptr(ct->info)) id = ctype_cid(ct->info);
|
||||
tv = lj_ctype_meta(cts, id, mm);
|
||||
}
|
||||
if (!tv && L->base+1 < L->top && tviscdata(L->base+1)) {
|
||||
CTypeID id = cdataV(L->base+1)->ctypeid;
|
||||
CType *ct = ctype_raw(cts, id);
|
||||
if (ctype_isptr(ct->info)) id = ctype_cid(ct->info);
|
||||
tv = lj_ctype_meta(cts, id, mm);
|
||||
}
|
||||
if (!tv) {
|
||||
const char *repr[2];
|
||||
int i, isenum = -1, isstr = -1;
|
||||
|
||||
Reference in New Issue
Block a user