Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qv4iterator.cpp
Go to the documentation of this file.
1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant
4#include <qv4iterator_p.h>
5#include <qv4symbol_p.h>
6#include <qv4engine_p.h>
7
8using namespace QV4;
9
10void IteratorPrototype::init(ExecutionEngine *engine)
11{
12 defineDefaultProperty(engine->symbol_iterator(), method_iterator, 0);
13}
14
15ReturnedValue IteratorPrototype::method_iterator(const FunctionObject *, const Value *thisObject, const Value *, int)
16{
17 return thisObject->asReturnedValue();
18}
19
20
21ReturnedValue IteratorPrototype::createIterResultObject(ExecutionEngine *engine, const Value &value, bool done)
22{
23 Scope scope(engine);
24 ScopedObject obj(scope, engine->newObject());
25 obj->set(ScopedString(scope, engine->newString(QStringLiteral("value"))), value, Object::DoNotThrow);
26 obj->set(ScopedString(scope, engine->newString(QStringLiteral("done"))), Value::fromBoolean(done), Object::DoNotThrow);
27 return obj->asReturnedValue();
28}