| 53 | } |
| 54 | |
| 55 | static bool array_reverse(JSContext *cx, unsigned argc, JS::Value *vp) { |
| 56 | JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| 57 | |
| 58 | JS::RootedObject proxy(cx, JS::ToObject(cx, args.thisv())); |
| 59 | if (!proxy) { |
| 60 | return false; |
| 61 | } |
| 62 | PyObject *self = JS::GetMaybePtrFromReservedSlot<PyObject>(proxy, PyObjectSlot); |
| 63 | |
| 64 | if (PyList_GET_SIZE(self) > 1) { |
| 65 | if (PyList_Reverse(self) < 0) { |
| 66 | return false; |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | // return ref to self |
| 71 | args.rval().set(jsTypeFactory(cx, self)); |
| 72 | return true; |
| 73 | } |
| 74 | |
| 75 | static bool array_pop(JSContext *cx, unsigned argc, JS::Value *vp) { |
| 76 | JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
nothing calls this directly
no test coverage detected