| 154 | } |
| 155 | |
| 156 | static bool DefineIterableIterator(JSContext *cx, JS::HandleObject global) { |
| 157 | JS::RootedObject iteratorPrototype(cx); |
| 158 | if (!JS_GetClassPrototype(cx, JSProto_Iterator, &iteratorPrototype)) { |
| 159 | return false; |
| 160 | } |
| 161 | |
| 162 | JS::RootedObject protoObj(cx, |
| 163 | JS_InitClass(cx, global, |
| 164 | nullptr, iteratorPrototype, |
| 165 | "IterableIterator", |
| 166 | IterableIteratorConstructor, 0, |
| 167 | nullptr, iterable_iterator_methods, |
| 168 | nullptr, nullptr) |
| 169 | ); |
| 170 | |
| 171 | return protoObj; // != nullptr |
| 172 | } |
| 173 | |
| 174 | static bool iterable_values(JSContext *cx, unsigned argc, JS::Value *vp) { |
| 175 | JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |