| 53 | |
| 54 | template<typename Cls> |
| 55 | static duk_ret_t call_native_deleter(duk_context* ctx) |
| 56 | { |
| 57 | duk_push_this(ctx); |
| 58 | duk_get_prop_string(ctx, -1, "\xFF" "obj_ptr"); |
| 59 | |
| 60 | if (!duk_is_pointer(ctx, -1)) { |
| 61 | duk_error(ctx, DUK_RET_REFERENCE_ERROR, "Object has already been invalidated; cannot delete."); |
| 62 | return DUK_RET_REFERENCE_ERROR; |
| 63 | } |
| 64 | |
| 65 | Cls* obj = static_cast<Cls*>(duk_require_pointer(ctx, -1)); |
| 66 | dukglue_invalidate_object(ctx, obj); |
| 67 | delete obj; |
| 68 | |
| 69 | duk_pop_2(ctx); |
| 70 | return 0; |
| 71 | } |
| 72 | } |
| 73 | } |
nothing calls this directly
no test coverage detected