| 50 | } |
| 51 | |
| 52 | PyObject *JSObjectIterProxyMethodDefinitions::JSObjectIterProxy_nextkey(JSObjectIterProxy *self) { |
| 53 | PyDictObject *dict = self->it.di_dict; |
| 54 | if (dict == NULL) { |
| 55 | return NULL; |
| 56 | } |
| 57 | |
| 58 | if (self->it.reversed) { |
| 59 | if (self->it.it_index >= 0) { |
| 60 | JS::HandleId id = (*(self->it.props))[(self->it.it_index)--]; |
| 61 | PyObject *key = idToKey(GLOBAL_CX, id); |
| 62 | PyObject *value; |
| 63 | |
| 64 | if (self->it.kind != KIND_KEYS) { |
| 65 | JS::RootedValue jsVal(GLOBAL_CX); |
| 66 | JS_GetPropertyById(GLOBAL_CX, *(((JSObjectProxy *)(self->it.di_dict))->jsObject), id, &jsVal); |
| 67 | value = pyTypeFactory(GLOBAL_CX, jsVal); |
| 68 | } |
| 69 | |
| 70 | PyObject *ret; |
| 71 | if (self->it.kind == KIND_ITEMS) { |
| 72 | ret = PyTuple_Pack(2, key, value); |
| 73 | } |
| 74 | else if (self->it.kind == KIND_VALUES) { |
| 75 | ret = value; |
| 76 | } |
| 77 | else { |
| 78 | ret = key; |
| 79 | } |
| 80 | |
| 81 | Py_INCREF(ret); |
| 82 | if (self->it.kind != KIND_KEYS) { |
| 83 | Py_DECREF(value); |
| 84 | } |
| 85 | |
| 86 | return ret; |
| 87 | } |
| 88 | } else { |
| 89 | if (self->it.it_index < JSObjectProxyMethodDefinitions::JSObjectProxy_length((JSObjectProxy *)dict)) { |
| 90 | JS::HandleId id = (*(self->it.props))[(self->it.it_index)++]; |
| 91 | PyObject *key = idToKey(GLOBAL_CX, id); |
| 92 | PyObject *value; |
| 93 | |
| 94 | if (self->it.kind != KIND_KEYS) { |
| 95 | JS::RootedValue jsVal(GLOBAL_CX); |
| 96 | JS_GetPropertyById(GLOBAL_CX, *(((JSObjectProxy *)(self->it.di_dict))->jsObject), id, &jsVal); |
| 97 | value = pyTypeFactory(GLOBAL_CX, jsVal); |
| 98 | } |
| 99 | |
| 100 | PyObject *ret; |
| 101 | if (self->it.kind == KIND_ITEMS) { |
| 102 | ret = PyTuple_Pack(2, key, value); |
| 103 | } |
| 104 | else if (self->it.kind == KIND_VALUES) { |
| 105 | ret = value; |
| 106 | } |
| 107 | else { |
| 108 | ret = key; |
| 109 | } |
nothing calls this directly
no test coverage detected