Merge mozilla-central to autoland. a=merge CLOSED TREE
[gecko.git] / js / public / Iterator.h
blob8a0a708ced1f90eced09a364f86eca98c699f114
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * vim: set ts=8 sts=4 et sw=4 tw=99:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef js_Iterator_h
8 #define js_Iterator_h
10 #include "js/TypeDecls.h"
12 namespace JS {
14 // https://tc39.es/ecma262/#sec-getiterator
15 // GetIterator
16 JSObject* GetIteratorObject(JSContext* cx, Handle<Value> obj, bool isAsync);
18 // https://tc39.es/ecma262/#sec-iteratornext
19 bool IteratorNext(JSContext* cx, Handle<JSObject*> iteratorRecord,
20 MutableHandle<Value> result);
22 // https://tc39.es/ecma262/#sec-iteratorcomplete
23 bool IteratorComplete(JSContext* cx, Handle<JSObject*> iterResult, bool* done);
25 // https://tc39.es/ecma262/#sec-iteratorvalue
26 bool IteratorValue(JSContext* cx, Handle<JSObject*> iterResult,
27 MutableHandle<Value> value);
29 // Implements iteratorRecord.[[Iterator]]
30 bool GetIteratorRecordIterator(JSContext* cx, Handle<JSObject*> iteratorRecord,
31 MutableHandle<Value> iterator);
33 // Implements GetMethod(iterator, "return").
34 bool GetReturnMethod(JSContext* cx, Handle<Value> iterator,
35 MutableHandle<Value> result);
37 } // namespace JS
39 #endif /* js_Iterator_h */