1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#define QT_QML_BUILD_REMOVED_API
#include "qtqmlglobal.h"
QT_USE_NAMESPACE
#if QT_QML_REMOVED_SINCE(6, 5)
#include <QtQml/qjsengine.h>
QJSValue QJSEngine::create(int typeId, const void *ptr)
{
QMetaType type(typeId);
return create(type, ptr);
}
bool QJSEngine::convertV2(const QJSValue &value, int type, void *ptr)
{
return convertV2(value, QMetaType(type), ptr);
}
#endif
#if QT_QML_REMOVED_SINCE(6, 6)
#include <QtQml/qqmlprivate.h>
#include <QtQml/private/qv4executablecompilationunit_p.h>
#include <QtQml/private/qv4lookup_p.h>
bool QQmlPrivate::AOTCompiledContext::getEnumLookup(uint index, int *target) const
{
using namespace QQmlPrivate;
QV4::Lookup *lookup = compilationUnit->runtimeLookups + index;
auto mt = QMetaType(lookup->qmlEnumValueLookup.metaType);
QVariant buffer(mt);
getEnumLookup(index, buffer.data());
*target = buffer.toInt();
return true;
}
#endif
#if QT_QML_REMOVED_SINCE(6, 9)
#include <QtQml/qqmlprivate.h>
#include <QtQml/private/qv4executablecompilationunit_p.h>
#include <QtQml/private/qv4lookup_p.h>
#include <QtQml/private/qv4qobjectwrapper_p.h>
bool QQmlPrivate::AOTCompiledContext::callObjectPropertyLookup(
uint index, QObject *object, void **args, const QMetaType *types, int argc) const
{
QV4::Lookup *lookup = compilationUnit->runtimeLookups + index;
QV4::Scope scope(engine->handle());
QV4::ScopedValue thisObject(scope, QV4::QObjectWrapper::wrap(scope.engine, object));
QV4::ScopedFunctionObject function(scope, lookup->getter(engine->handle(), thisObject));
if (!function) {
scope.engine->throwTypeError(
QStringLiteral("Property '%1' of object [object Object] is not a function")
.arg(compilationUnit->runtimeStrings[lookup->nameIndex]->toQString()));
return false;
}
function->call(object, args, types, argc);
return !scope.hasException();
}
void QQmlPrivate::AOTCompiledContext::initCallObjectPropertyLookup(uint index) const
{
Q_UNUSED(index);
Q_ASSERT(engine->hasError());
engine->handle()->amendException();
}
bool QQmlPrivate::AOTCompiledContext::callQmlContextPropertyLookup(
uint index, void **args, const QMetaType *types, int argc) const
{
QV4::Lookup *lookup = compilationUnit->runtimeLookups + index;
QV4::Scope scope(engine->handle());
QV4::ScopedValue thisObject(scope);
QV4::ScopedFunctionObject function(
scope, lookup->contextGetter(scope.engine, thisObject));
if (!function) {
scope.engine->throwTypeError(
QStringLiteral("Property '%1' of object [null] is not a function").arg(
compilationUnit->runtimeStrings[lookup->nameIndex]->toQString()));
return false;
}
function->call(qmlScopeObject, args, types, argc);
return !scope.hasException();
}
void QQmlPrivate::AOTCompiledContext::initCallQmlContextPropertyLookup(uint index) const
{
Q_UNUSED(index);
Q_ASSERT(engine->hasError());
engine->handle()->amendException();
}
bool QQmlPrivate::AOTCompiledContext::loadGlobalLookup(uint index, void *target, QMetaType type) const
{
QV4::Lookup *lookup = compilationUnit->runtimeLookups + index;
QV4::Scope scope(engine->handle());
QV4::ScopedValue v(scope, lookup->globalGetter(engine->handle()));
if (!QV4::ExecutionEngine::metaTypeFromJS(
v, type, target)) {
engine->handle()->throwTypeError();
return false;
}
return true;
}
void QQmlPrivate::AOTCompiledContext::initLoadGlobalLookup(uint index) const
{
Q_UNUSED(index);
Q_ASSERT(engine->hasError());
engine->handle()->amendException();
}
QVariant QQmlPrivate::AOTCompiledContext::constructValueType(
QMetaType resultMetaType, const QMetaObject *resultMetaObject,
int ctorIndex, void *ctorArg) const
{
void *args[] = {ctorArg};
return QQmlValueTypeProvider::constructValueType(
resultMetaType, resultMetaObject, ctorIndex, args);
}
bool QQmlPrivate::AOTCompiledContext::callGlobalLookup(
uint index, void **args, const QMetaType *types, int argc) const
{
QV4::Lookup *lookup = compilationUnit->runtimeLookups + index;
QV4::Scope scope(engine->handle());
QV4::ScopedFunctionObject function(scope, lookup->globalGetter(scope.engine));
if (!function) {
scope.engine->throwTypeError(
QStringLiteral("Property '%1' of object [null] is not a function")
.arg(compilationUnit->runtimeStrings[lookup->nameIndex]->toQString()));
return false;
}
function->call(nullptr, args, types, argc);
return true;
}
void QQmlPrivate::AOTCompiledContext::initCallGlobalLookup(uint index) const
{
Q_UNUSED(index);
Q_ASSERT(engine->hasError());
engine->handle()->amendException();
}
void QQmlPrivate::AOTCompiledContext::initLoadScopeObjectPropertyLookup(
uint index, QMetaType type) const
{
Q_UNUSED(type);
return initLoadScopeObjectPropertyLookup(index);
}
void QQmlPrivate::AOTCompiledContext::initGetObjectLookup(
uint index, QObject *object, QMetaType type) const
{
return type == QMetaType::fromType<QVariant>()
? initGetObjectLookupAsVariant(index, object)
: initGetObjectLookup(index, object);
}
void QQmlPrivate::AOTCompiledContext::initSetObjectLookup(
uint index, QObject *object, QMetaType type) const
{
return type == QMetaType::fromType<QVariant>()
? initSetObjectLookupAsVariant(index, object)
: initSetObjectLookup(index, object);
}
void QQmlPrivate::AOTCompiledContext::initGetValueLookup(
uint index, const QMetaObject *metaObject, QMetaType type) const {
Q_UNUSED(type);
initGetValueLookup(index, metaObject);
}
void QQmlPrivate::AOTCompiledContext::initSetValueLookup(
uint index, const QMetaObject *metaObject, QMetaType type) const
{
Q_UNUSED(type);
initSetValueLookup(index, metaObject);
}
#endif
|