aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4qobjectwrapper.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-08-11 12:46:56 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-01-25 23:55:27 +0100
commitb48b1e09ccdd5ade49b36dece9e1d5d422543786 (patch)
tree6ae314682027bfeba8026b2dbb41bb484f80bace /src/qml/jsruntime/qv4qobjectwrapper.cpp
parent71597472ddbe6957f47ae61b72c147846a80f16f (diff)
Place all of qv4qobjectwrapper.cpp in namespace QV4
We already had to open the namespace once. This way we can avoid the using declaration and get rid of most of the QV4:: qualification. Task-number: QTBUG-90898 Change-Id: I83c82b20538c418998db8ab8860843b995b4f4a3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4qobjectwrapper.cpp')
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp344
1 files changed, 170 insertions, 174 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index e4ba9e7798..a63f1fc7f9 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -93,14 +93,14 @@ Q_LOGGING_CATEGORY(lcObjectConnect, "qt.qml.object.connect", QtWarningMsg)
// so turn off the warnings for us to have a clean build
QT_WARNING_DISABLE_GCC("-Wstrict-aliasing")
-using namespace QV4;
+namespace QV4 {
-QPair<QObject *, int> QObjectMethod::extractQtMethod(const QV4::FunctionObject *function)
+QPair<QObject *, int> QObjectMethod::extractQtMethod(const FunctionObject *function)
{
- QV4::ExecutionEngine *v4 = function->engine();
+ ExecutionEngine *v4 = function->engine();
if (v4) {
- QV4::Scope scope(v4);
- QV4::Scoped<QObjectMethod> method(scope, function->as<QObjectMethod>());
+ Scope scope(v4);
+ Scoped<QObjectMethod> method(scope, function->as<QObjectMethod>());
if (method)
return qMakePair(method->object(), method->methodIndex());
}
@@ -108,16 +108,16 @@ QPair<QObject *, int> QObjectMethod::extractQtMethod(const QV4::FunctionObject *
return qMakePair((QObject *)nullptr, -1);
}
-static QPair<QObject *, int> extractQtSignal(const QV4::Value &value)
+static QPair<QObject *, int> extractQtSignal(const Value &value)
{
if (value.isObject()) {
- QV4::ExecutionEngine *v4 = value.as<QV4::Object>()->engine();
- QV4::Scope scope(v4);
- QV4::ScopedFunctionObject function(scope, value);
+ ExecutionEngine *v4 = value.as<Object>()->engine();
+ Scope scope(v4);
+ ScopedFunctionObject function(scope, value);
if (function)
return QObjectMethod::extractQtMethod(function);
- QV4::Scoped<QV4::QmlSignalHandler> handler(scope, value);
+ Scoped<QmlSignalHandler> handler(scope, value);
if (handler)
return qMakePair(handler->object(), handler->signalIndex());
}
@@ -125,19 +125,19 @@ static QPair<QObject *, int> extractQtSignal(const QV4::Value &value)
return qMakePair((QObject *)nullptr, -1);
}
-static QV4::ReturnedValue loadProperty(QV4::ExecutionEngine *v4, QObject *object,
+static ReturnedValue loadProperty(ExecutionEngine *v4, QObject *object,
const QQmlPropertyData &property)
{
Q_ASSERT(!property.isFunction());
- QV4::Scope scope(v4);
+ Scope scope(v4);
if (property.isQObject()) {
QObject *rv = nullptr;
property.readProperty(object, &rv);
- QV4::ReturnedValue ret = QV4::QObjectWrapper::wrap(v4, rv);
+ ReturnedValue ret = QObjectWrapper::wrap(v4, rv);
if (property.propType().flags().testFlag(QMetaType::IsConst)) {
- QV4::ScopedValue v(scope, ret);
- if (auto obj = v->as<QV4::Object>()) {
+ ScopedValue v(scope, ret);
+ if (auto obj = v->as<Object>()) {
obj->setInternalClass(obj->internalClass()->cryopreserved());
return obj->asReturnedValue();
}
@@ -153,12 +153,12 @@ static QV4::ReturnedValue loadProperty(QV4::ExecutionEngine *v4, QObject *object
case QMetaType::Int: {
int v = 0;
property.readProperty(object, &v);
- return QV4::Encode(v);
+ return Encode(v);
}
case QMetaType::Bool: {
bool v = false;
property.readProperty(object, &v);
- return QV4::Encode(v);
+ return Encode(v);
}
case QMetaType::QString: {
QString v;
@@ -168,17 +168,17 @@ static QV4::ReturnedValue loadProperty(QV4::ExecutionEngine *v4, QObject *object
case QMetaType::UInt: {
uint v = 0;
property.readProperty(object, &v);
- return QV4::Encode(v);
+ return Encode(v);
}
case QMetaType::Float: {
float v = 0;
property.readProperty(object, &v);
- return QV4::Encode(v);
+ return Encode(v);
}
case QMetaType::Double: {
double v = 0;
property.readProperty(object, &v);
- return QV4::Encode(v);
+ return Encode(v);
}
default:
break;
@@ -196,7 +196,7 @@ static QV4::ReturnedValue loadProperty(QV4::ExecutionEngine *v4, QObject *object
if (QQmlMetaType::isValueType(v.metaType())) {
if (const QMetaObject *valueTypeMetaObject = QQmlMetaType::metaObjectForValueType(v.metaType()))
- return QV4::QQmlValueTypeWrapper::create(v4, object, property.coreIndex(), valueTypeMetaObject, v.metaType()); // VariantReference value-type.
+ return QQmlValueTypeWrapper::create(v4, object, property.coreIndex(), valueTypeMetaObject, v.metaType()); // VariantReference value-type.
}
return scope.engine->fromVariant(v);
@@ -204,11 +204,11 @@ static QV4::ReturnedValue loadProperty(QV4::ExecutionEngine *v4, QObject *object
if (QQmlMetaType::isValueType(propMetaType)) {
if (const QMetaObject *valueTypeMetaObject = QQmlMetaType::metaObjectForValueType(propMetaType))
- return QV4::QQmlValueTypeWrapper::create(v4, object, property.coreIndex(), valueTypeMetaObject, propMetaType);
+ return QQmlValueTypeWrapper::create(v4, object, property.coreIndex(), valueTypeMetaObject, propMetaType);
} else {
// see if it's a sequence type
bool succeeded = false;
- QV4::ScopedValue retn(scope, QV4::SequencePrototype::newSequence(
+ ScopedValue retn(scope, SequencePrototype::newSequence(
v4, propMetaType, object, property.coreIndex(),
!property.isWritable(), &succeeded));
if (succeeded)
@@ -219,7 +219,7 @@ static QV4::ReturnedValue loadProperty(QV4::ExecutionEngine *v4, QObject *object
QMetaProperty p = object->metaObject()->property(property.coreIndex());
qWarning("QMetaProperty::read: Unable to handle unregistered datatype '%s' for property "
"'%s::%s'", p.typeName(), object->metaObject()->className(), p.name());
- return QV4::Encode::undefined();
+ return Encode::undefined();
} else {
QVariant v(property.propType(), (void *)nullptr);
property.readProperty(object, v.data());
@@ -269,13 +269,13 @@ ReturnedValue QObjectWrapper::getProperty(ExecutionEngine *engine, QObject *obje
ScopedContext global(scope, engine->qmlContext());
if (!global)
global = engine->rootContext();
- return QV4::QObjectMethod::create(global, object, property->coreIndex());
+ return QObjectMethod::create(global, object, property->coreIndex());
} else if (property->isSignalHandler()) {
QmlSignalHandler::initProto(engine);
- return engine->memoryManager->allocate<QV4::QmlSignalHandler>(object, property->coreIndex())->asReturnedValue();
+ return engine->memoryManager->allocate<QmlSignalHandler>(object, property->coreIndex())->asReturnedValue();
} else {
ExecutionContext *global = engine->rootContext();
- return QV4::QObjectMethod::create(global, object, property->coreIndex());
+ return QObjectMethod::create(global, object, property->coreIndex());
}
}
@@ -298,16 +298,16 @@ static OptionalReturnedValue getDestroyOrToStringMethod(ExecutionEngine *v4, Str
{
int index = 0;
if (name->equals(v4->id_destroy()))
- index = QV4::QObjectMethod::DestroyMethod;
+ index = QObjectMethod::DestroyMethod;
else if (name->equals(v4->id_toString()))
- index = QV4::QObjectMethod::ToStringMethod;
+ index = QObjectMethod::ToStringMethod;
else
return OptionalReturnedValue();
if (hasProperty)
*hasProperty = true;
ExecutionContext *global = v4->rootContext();
- return OptionalReturnedValue(QV4::QObjectMethod::create(global, qobj, index));
+ return OptionalReturnedValue(QObjectMethod::create(global, qobj, index));
}
static OptionalReturnedValue getPropertyFromImports(
@@ -326,7 +326,7 @@ static OptionalReturnedValue getPropertyFromImports(
return OptionalReturnedValue();
if (r.scriptIndex != -1) {
- return OptionalReturnedValue(QV4::Encode::undefined());
+ return OptionalReturnedValue(Encode::undefined());
} else if (r.type.isValid()) {
return OptionalReturnedValue(QQmlTypeWrapper::create(v4, qobj,r.type, Heap::QQmlTypeWrapper::ExcludeEnums));
} else if (r.importNamespace) {
@@ -347,7 +347,7 @@ ReturnedValue QObjectWrapper::getQmlProperty(
if (QQmlData::wasDeleted(d()->object())) {
if (hasProperty)
*hasProperty = false;
- return QV4::Encode::undefined();
+ return Encode::undefined();
}
ExecutionEngine *v4 = engine();
@@ -364,16 +364,16 @@ ReturnedValue QObjectWrapper::getQmlProperty(
if (auto importProperty = getPropertyFromImports(v4, name, qmlContext, d()->object(), hasProperty))
return *importProperty;
}
- return QV4::Object::virtualGet(this, name->propertyKey(), this, hasProperty);
+ return Object::virtualGet(this, name->propertyKey(), this, hasProperty);
}
QQmlData *ddata = QQmlData::get(d()->object(), false);
- if (revisionMode == QV4::QObjectWrapper::CheckRevision && result->hasRevision()) {
+ if (revisionMode == QObjectWrapper::CheckRevision && result->hasRevision()) {
if (ddata && ddata->propertyCache && !ddata->propertyCache->isAllowedInRevision(result)) {
if (hasProperty)
*hasProperty = false;
- return QV4::Encode::undefined();
+ return Encode::undefined();
}
}
@@ -384,14 +384,14 @@ ReturnedValue QObjectWrapper::getQmlProperty(
}
ReturnedValue QObjectWrapper::getQmlProperty(
- QV4::ExecutionEngine *engine, const QQmlRefPointer<QQmlContextData> &qmlContext,
+ ExecutionEngine *engine, const QQmlRefPointer<QQmlContextData> &qmlContext,
QObject *object, String *name, QObjectWrapper::RevisionMode revisionMode, bool *hasProperty,
QQmlPropertyData **property)
{
if (QQmlData::wasDeleted(object)) {
if (hasProperty)
*hasProperty = false;
- return QV4::Encode::null();
+ return Encode::null();
}
if (auto methodValue = getDestroyOrToStringMethod(engine, name, object, hasProperty))
@@ -402,11 +402,11 @@ ReturnedValue QObjectWrapper::getQmlProperty(
QQmlPropertyData *result = findProperty(object, qmlContext, name, revisionMode, &local);
if (result) {
- if (revisionMode == QV4::QObjectWrapper::CheckRevision && result->hasRevision()) {
+ if (revisionMode == QObjectWrapper::CheckRevision && result->hasRevision()) {
if (ddata && ddata->propertyCache && !ddata->propertyCache->isAllowedInRevision(result)) {
if (hasProperty)
*hasProperty = false;
- return QV4::Encode::undefined();
+ return Encode::undefined();
}
}
@@ -426,7 +426,7 @@ ReturnedValue QObjectWrapper::getQmlProperty(
// Not wrapped. Last chance: try query QObjectWrapper's prototype.
// If it can't handle this, then there is no point
// to wrap the QObject just to look at an empty set of JS props.
- QV4::Object *proto = QObjectWrapper::defaultPrototype(engine);
+ Object *proto = QObjectWrapper::defaultPrototype(engine);
return proto->get(name, hasProperty);
}
}
@@ -435,12 +435,12 @@ ReturnedValue QObjectWrapper::getQmlProperty(
// There's no point wrapping again, as there wouldn't be any new props.
Q_ASSERT(ddata);
- QV4::Scope scope(engine);
- QV4::Scoped<QObjectWrapper> wrapper(scope, wrap(engine, object));
+ Scope scope(engine);
+ Scoped<QObjectWrapper> wrapper(scope, wrap(engine, object));
if (!wrapper) {
if (hasProperty)
*hasProperty = false;
- return QV4::Encode::null();
+ return Encode::null();
}
return wrapper->getQmlProperty(qmlContext, name, revisionMode, hasProperty);
}
@@ -458,7 +458,7 @@ bool QObjectWrapper::setQmlProperty(
if (!result)
return false;
- if (revisionMode == QV4::QObjectWrapper::CheckRevision && result->hasRevision()) {
+ if (revisionMode == QObjectWrapper::CheckRevision && result->hasRevision()) {
QQmlData *ddata = QQmlData::get(object);
if (ddata && ddata->propertyCache && !ddata->propertyCache->isAllowedInRevision(result))
return false;
@@ -479,8 +479,8 @@ void QObjectWrapper::setProperty(
return;
}
- QV4::Scope scope(engine);
- if (QV4::ScopedFunctionObject f(scope, value); f) {
+ Scope scope(engine);
+ if (ScopedFunctionObject f(scope, value); f) {
if (!f->isBinding()) {
const bool isAliasToAllowed = [&]() {
if (property->isAlias()) {
@@ -512,9 +512,9 @@ void QObjectWrapper::setProperty(
} else {
QQmlRefPointer<QQmlContextData> callingQmlContext = scope.engine->callingQmlContext();
- QV4::Scoped<QQmlBindingFunction> bindingFunction(scope, (const Value &)f);
- QV4::ScopedFunctionObject f(scope, bindingFunction->bindingFunction());
- QV4::ScopedContext ctx(scope, f->scope());
+ Scoped<QQmlBindingFunction> bindingFunction(scope, (const Value &)f);
+ ScopedFunctionObject f(scope, bindingFunction->bindingFunction());
+ ScopedContext ctx(scope, f->scope());
// binding assignment.
if (property->isBindable()) {
@@ -522,7 +522,7 @@ void QObjectWrapper::setProperty(
auto [targetObject, targetIndex] = QQmlPropertyPrivate::findAliasTarget(object, idx);
QUntypedPropertyBinding binding;
if (f->isBoundFunction()) {
- auto boundFunction = static_cast<QV4::BoundFunction *>(f.getPointer());
+ auto boundFunction = static_cast<BoundFunction *>(f.getPointer());
binding = QQmlPropertyBinding::createFromBoundFunction(property, boundFunction, object, callingQmlContext,
ctx, targetObject, targetIndex);
} else {
@@ -543,7 +543,7 @@ void QObjectWrapper::setProperty(
QQmlBinding *newBinding = QQmlBinding::create(property, f->function(), object, callingQmlContext, ctx);
newBinding->setSourceLocation(bindingFunction->currentLocation());
if (f->isBoundFunction())
- newBinding->setBoundFunction(static_cast<QV4::BoundFunction *>(f.getPointer()));
+ newBinding->setBoundFunction(static_cast<BoundFunction *>(f.getPointer()));
newBinding->setTarget(object, *property, nullptr);
QQmlPropertyPrivate::setBinding(newBinding);
}
@@ -624,7 +624,7 @@ void QObjectWrapper::setProperty(
ss.d->numberValue = value.toNumber();
ss.d->isNumberLiteral = true;
} else if (value.isString()) {
- ss.d->script = QV4::CompiledData::Binding::escapedString(ss.d->script);
+ ss.d->script = CompiledData::Binding::escapedString(ss.d->script);
ss.d->isStringLiteral = true;
}
PROPERTY_STORE(QQmlScriptString, ss);
@@ -661,7 +661,7 @@ ReturnedValue QObjectWrapper::wrap_slowPath(ExecutionEngine *engine, QObject *ob
QQmlData *ddata = QQmlData::get(object, true);
if (!ddata)
- return QV4::Encode::undefined();
+ return Encode::undefined();
Scope scope(engine);
@@ -670,7 +670,7 @@ ReturnedValue QObjectWrapper::wrap_slowPath(ExecutionEngine *engine, QObject *ob
ddata->jsEngineId == 0 || // No one owns the QObject
!ddata->hasTaintedV4Object)) { // Someone else has used the QObject, but it isn't tainted
- QV4::ScopedValue rv(scope, create(engine, object));
+ ScopedValue rv(scope, create(engine, object));
ddata->jsWrapper.set(scope.engine, rv);
ddata->jsEngineId = engine->m_engineId;
return rv->asReturnedValue();
@@ -685,7 +685,7 @@ ReturnedValue QObjectWrapper::wrap_slowPath(ExecutionEngine *engine, QObject *ob
// If our tainted handle doesn't exist or has been collected, and there isn't
// a handle in the ddata, we can assume ownership of the ddata->jsWrapper
if (ddata->jsWrapper.isUndefined() && !alternateWrapper) {
- QV4::ScopedValue result(scope, create(engine, object));
+ ScopedValue result(scope, create(engine, object));
ddata->jsWrapper.set(scope.engine, result);
ddata->jsEngineId = engine->m_engineId;
return result->asReturnedValue();
@@ -712,7 +712,7 @@ void QObjectWrapper::markWrapper(QObject *object, MarkStack *markStack)
if (!ddata)
return;
- const QV4::ExecutionEngine *engine = markStack->engine();
+ const ExecutionEngine *engine = markStack->engine();
if (ddata->jsEngineId == engine->m_engineId)
ddata->jsWrapper.markOnce(markStack);
else if (engine->m_multiplyWrappedQObjects && ddata->hasTaintedV4Object)
@@ -743,11 +743,11 @@ void QObjectWrapper::setProperty(ExecutionEngine *engine, QObject *object, int p
bool QObjectWrapper::virtualIsEqualTo(Managed *a, Managed *b)
{
- Q_ASSERT(a->as<QV4::QObjectWrapper>());
- QV4::QObjectWrapper *qobjectWrapper = static_cast<QV4::QObjectWrapper *>(a);
- QV4::Object *o = b->as<Object>();
+ Q_ASSERT(a->as<QObjectWrapper>());
+ QObjectWrapper *qobjectWrapper = static_cast<QObjectWrapper *>(a);
+ Object *o = b->as<Object>();
if (o) {
- if (QV4::QQmlTypeWrapper *qmlTypeWrapper = o->as<QV4::QQmlTypeWrapper>())
+ if (QQmlTypeWrapper *qmlTypeWrapper = o->as<QQmlTypeWrapper>())
return qmlTypeWrapper->toVariant().value<QObject*>() == qobjectWrapper->object();
}
@@ -757,15 +757,15 @@ bool QObjectWrapper::virtualIsEqualTo(Managed *a, Managed *b)
ReturnedValue QObjectWrapper::create(ExecutionEngine *engine, QObject *object)
{
if (QQmlRefPointer<QQmlPropertyCache> cache = QQmlData::ensurePropertyCache(object)) {
- ReturnedValue result = QV4::Encode::null();
+ ReturnedValue result = Encode::null();
void *args[] = { &result, &engine };
if (cache->callJSFactoryMethod(object, args))
return result;
}
- return (engine->memoryManager->allocate<QV4::QObjectWrapper>(object))->asReturnedValue();
+ return (engine->memoryManager->allocate<QObjectWrapper>(object))->asReturnedValue();
}
-QV4::ReturnedValue QObjectWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty)
+ReturnedValue QObjectWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty)
{
if (!id.isString())
return Object::virtualGet(m, id, receiver, hasProperty);
@@ -797,7 +797,7 @@ bool QObjectWrapper::virtualPut(Managed *m, PropertyKey id, const Value &value,
return false;
QQmlRefPointer<QQmlContextData> qmlContext = scope.engine->callingQmlContext();
- if (!setQmlProperty(scope.engine, qmlContext, that->d()->object(), name, QV4::QObjectWrapper::IgnoreRevision, value)) {
+ if (!setQmlProperty(scope.engine, qmlContext, that->d()->object(), name, QObjectWrapper::IgnoreRevision, value)) {
QQmlData *ddata = QQmlData::get(that->d()->object());
// Types created by QML are not extensible at run-time, but for other QObjects we can store them
// as regular JavaScript properties, like on JavaScript objects.
@@ -807,7 +807,7 @@ bool QObjectWrapper::virtualPut(Managed *m, PropertyKey id, const Value &value,
scope.engine->throwError(error);
return false;
} else {
- return QV4::Object::virtualPut(m, id, value, receiver);
+ return Object::virtualPut(m, id, value, receiver);
}
}
@@ -831,25 +831,25 @@ PropertyAttributes QObjectWrapper::virtualGetOwnProperty(const Managed *m, Prope
bool hasProperty;
p->value = that->getQmlProperty(qmlContext, n, IgnoreRevision, &hasProperty, /*includeImports*/ true);
}
- return QV4::Attr_Data;
+ return Attr_Data;
}
}
}
- return QV4::Object::virtualGetOwnProperty(m, id, p);
+ return Object::virtualGetOwnProperty(m, id, p);
}
struct QObjectWrapperOwnPropertyKeyIterator : ObjectOwnPropertyKeyIterator
{
int propertyIndex = 0;
~QObjectWrapperOwnPropertyKeyIterator() override = default;
- PropertyKey next(const QV4::Object *o, Property *pd = nullptr, PropertyAttributes *attrs = nullptr) override;
+ PropertyKey next(const Object *o, Property *pd = nullptr, PropertyAttributes *attrs = nullptr) override;
private:
QSet<QByteArray> m_alreadySeen;
};
-PropertyKey QObjectWrapperOwnPropertyKeyIterator::next(const QV4::Object *o, Property *pd, PropertyAttributes *attrs)
+PropertyKey QObjectWrapperOwnPropertyKeyIterator::next(const Object *o, Property *pd, PropertyAttributes *attrs)
{
// Used to block access to QObject::destroyed() and QObject::deleteLater() from QML
static const int destroyedIdx1 = QObject::staticMetaObject.indexOfSignal("destroyed(QObject*)");
@@ -871,7 +871,7 @@ PropertyKey QObjectWrapperOwnPropertyKeyIterator::next(const QV4::Object *o, Pro
ScopedString propName(scope, thatEngine->newString(QString::fromUtf8(property.name())));
++propertyIndex;
if (attrs)
- *attrs= QV4::Attr_Data;
+ *attrs= Attr_Data;
if (pd) {
QQmlPropertyData local;
local.load(property);
@@ -896,7 +896,7 @@ PropertyKey QObjectWrapperOwnPropertyKeyIterator::next(const QV4::Object *o, Pro
Scope scope(thatEngine);
ScopedString methodName(scope, thatEngine->newString(QString::fromUtf8(method.name())));
if (attrs)
- *attrs = QV4::Attr_Data;
+ *attrs = Attr_Data;
if (pd) {
QQmlPropertyData local;
local.load(method);
@@ -931,7 +931,7 @@ ReturnedValue QObjectWrapper::virtualResolveLookupGetter(const Object *object, E
QObject * const qobj = This->d()->object();
if (QQmlData::wasDeleted(qobj))
- return QV4::Encode::undefined();
+ return Encode::undefined();
if (auto methodValue = getDestroyOrToStringMethod(engine, name, qobj))
return *methodValue;
@@ -940,7 +940,7 @@ ReturnedValue QObjectWrapper::virtualResolveLookupGetter(const Object *object, E
if (!ddata || !ddata->propertyCache) {
QQmlPropertyData local;
QQmlPropertyData *property = QQmlPropertyCache::property(qobj, name, qmlContext, &local);
- return property ? getProperty(engine, qobj, property) : QV4::Encode::undefined();
+ return property ? getProperty(engine, qobj, property) : Encode::undefined();
}
QQmlPropertyData *property = ddata->propertyCache->property(name.getPointer(), qobj, qmlContext);
@@ -950,18 +950,18 @@ ReturnedValue QObjectWrapper::virtualResolveLookupGetter(const Object *object, E
if (auto importProperty = getPropertyFromImports(engine, name, qmlContext, qobj))
return *importProperty;
}
- return QV4::Object::virtualResolveLookupGetter(object, engine, lookup);
+ return Object::virtualResolveLookupGetter(object, engine, lookup);
}
- QV4::setupQObjectLookup(lookup, ddata, property, This);
- lookup->getter = QV4::Lookup::getterQObject;
+ setupQObjectLookup(lookup, ddata, property, This);
+ lookup->getter = Lookup::getterQObject;
return lookup->getter(lookup, engine, *object);
}
ReturnedValue QObjectWrapper::lookupAttached(
Lookup *l, ExecutionEngine *engine, const Value &object)
{
- return QV4::Lookup::getterGeneric(l, engine, object);
+ return Lookup::getterGeneric(l, engine, object);
}
bool QObjectWrapper::virtualResolveLookupSetter(Object *object, ExecutionEngine *engine, Lookup *lookup,
@@ -970,12 +970,10 @@ bool QObjectWrapper::virtualResolveLookupSetter(Object *object, ExecutionEngine
return Object::virtualResolveLookupSetter(object, engine, lookup, value);
}
-namespace QV4 {
-
struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
{
- QV4::PersistentValue function;
- QV4::PersistentValue thisObject;
+ PersistentValue function;
+ PersistentValue thisObject;
QMetaMethod signal;
QObjectSlotDispatcher()
@@ -992,7 +990,7 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
break;
case Call: {
QObjectSlotDispatcher *This = static_cast<QObjectSlotDispatcher*>(this_);
- QV4::ExecutionEngine *v4 = This->function.engine();
+ ExecutionEngine *v4 = This->function.engine();
// Might be that we're still connected to a signal that's emitted long
// after the engine died. We don't track connections in a global list, so
// we need this safeguard.
@@ -1004,10 +1002,10 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
int argCount = storage.size();
- QV4::Scope scope(v4);
- QV4::ScopedFunctionObject f(scope, This->function.value());
+ Scope scope(v4);
+ ScopedFunctionObject f(scope, This->function.value());
- QV4::JSCallArguments jsCallData(scope, argCount);
+ JSCallArguments jsCallData(scope, argCount);
*jsCallData.thisObject = This->thisObject.isUndefined() ? v4->globalObject->asReturnedValue() : This->thisObject.value();
for (int ii = 0; ii < argCount; ++ii) {
QMetaType type = storage[ii];
@@ -1022,7 +1020,7 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
if (scope.hasException()) {
QQmlError error = v4->catchExceptionAsQmlError();
if (error.description().isEmpty()) {
- QV4::ScopedString name(scope, f->name());
+ ScopedString name(scope, f->name());
error.setDescription(QStringLiteral("Unknown exception occurred during evaluation of connected function: %1").arg(name->toQString()));
}
if (QQmlEngine *qmlEngine = v4->qmlEngine()) {
@@ -1045,15 +1043,15 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
// This is tricky. Normally the metaArgs[0] pointer is a pointer to the _function_
// for the new-style QObject::connect. Here we use the engine pointer as sentinel
// to distinguish those type of QSlotObjectBase connections from our QML connections.
- QV4::ExecutionEngine *v4 = reinterpret_cast<QV4::ExecutionEngine*>(metaArgs[0]);
+ ExecutionEngine *v4 = reinterpret_cast<ExecutionEngine*>(metaArgs[0]);
if (v4 != connection->function.engine()) {
*ret = false;
return;
}
- QV4::Scope scope(v4);
- QV4::ScopedValue function(scope, *reinterpret_cast<QV4::Value*>(metaArgs[1]));
- QV4::ScopedValue thisObject(scope, *reinterpret_cast<QV4::Value*>(metaArgs[2]));
+ Scope scope(v4);
+ ScopedValue function(scope, *reinterpret_cast<Value*>(metaArgs[1]));
+ ScopedValue thisObject(scope, *reinterpret_cast<Value*>(metaArgs[2]));
QObject *receiverToDisconnect = reinterpret_cast<QObject*>(metaArgs[3]);
int slotIndexToDisconnect = *reinterpret_cast<int*>(metaArgs[4]);
@@ -1062,7 +1060,7 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
if (connection->thisObject.isUndefined() == thisObject->isUndefined() &&
(connection->thisObject.isUndefined() || RuntimeHelpers::strictEqual(*connection->thisObject.valueRef(), thisObject))) {
- QV4::ScopedFunctionObject f(scope, connection->function.value());
+ ScopedFunctionObject f(scope, connection->function.value());
QPair<QObject *, int> connectedFunctionData = QObjectMethod::extractQtMethod(f);
if (connectedFunctionData.first == receiverToDisconnect &&
connectedFunctionData.second == slotIndexToDisconnect) {
@@ -1089,11 +1087,9 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
};
};
-} // namespace QV4
-
ReturnedValue QObjectWrapper::method_connect(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
{
- QV4::Scope scope(b);
+ Scope scope(b);
if (argc == 0)
THROW_GENERIC_ERROR("Function.prototype.connect: no arguments given");
@@ -1112,8 +1108,8 @@ ReturnedValue QObjectWrapper::method_connect(const FunctionObject *b, const Valu
if (signalMetaMethod.methodType() != QMetaMethod::Signal)
THROW_GENERIC_ERROR("Function.prototype.connect: this object is not a signal");
- QV4::ScopedFunctionObject f(scope);
- QV4::ScopedValue object (scope, QV4::Encode::undefined());
+ ScopedFunctionObject f(scope);
+ ScopedValue object (scope, Encode::undefined());
if (argc == 1) {
f = argv[0];
@@ -1128,7 +1124,7 @@ ReturnedValue QObjectWrapper::method_connect(const FunctionObject *b, const Valu
if (!object->isUndefined() && !object->isObject())
THROW_GENERIC_ERROR("Function.prototype.connect: target this is not an object");
- QV4::QObjectSlotDispatcher *slot = new QV4::QObjectSlotDispatcher;
+ QObjectSlotDispatcher *slot = new QObjectSlotDispatcher;
slot->signal = signalMetaMethod;
slot->thisObject.set(scope.engine, object);
@@ -1155,7 +1151,7 @@ ReturnedValue QObjectWrapper::method_connect(const FunctionObject *b, const Valu
ReturnedValue QObjectWrapper::method_disconnect(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
{
- QV4::Scope scope(b);
+ Scope scope(b);
if (argc == 0)
THROW_GENERIC_ERROR("Function.prototype.disconnect: no arguments given");
@@ -1173,8 +1169,8 @@ ReturnedValue QObjectWrapper::method_disconnect(const FunctionObject *b, const V
if (signalIndex < 0 || signalObject->metaObject()->method(signalIndex).methodType() != QMetaMethod::Signal)
THROW_GENERIC_ERROR("Function.prototype.disconnect: this object is not a signal");
- QV4::ScopedFunctionObject functionValue(scope);
- QV4::ScopedValue functionThisValue(scope, QV4::Encode::undefined());
+ ScopedFunctionObject functionValue(scope);
+ ScopedValue functionThisValue(scope, Encode::undefined());
if (argc == 1) {
functionValue = argv[0];
@@ -1210,7 +1206,7 @@ ReturnedValue QObjectWrapper::method_disconnect(const FunctionObject *b, const V
RETURN_UNDEFINED();
}
-static void markChildQObjectsRecursively(QObject *parent, QV4::MarkStack *markStack)
+static void markChildQObjectsRecursively(QObject *parent, MarkStack *markStack)
{
const QObjectList &children = parent->children();
for (int i = 0; i < children.count(); ++i) {
@@ -1222,7 +1218,7 @@ static void markChildQObjectsRecursively(QObject *parent, QV4::MarkStack *markSt
}
}
-void Heap::QObjectWrapper::markObjects(Heap::Base *that, QV4::MarkStack *markStack)
+void Heap::QObjectWrapper::markObjects(Heap::Base *that, MarkStack *markStack)
{
QObjectWrapper *This = static_cast<QObjectWrapper *>(that);
@@ -1302,7 +1298,7 @@ struct CallArgument {
inline void *dataPtr();
inline void initAsType(QMetaType type);
- inline bool fromValue(QMetaType type, ExecutionEngine *, const QV4::Value &);
+ inline bool fromValue(QMetaType type, ExecutionEngine *, const Value &);
inline ReturnedValue toValue(ExecutionEngine *);
private:
@@ -1313,7 +1309,7 @@ private:
inline void cleanup();
template <class T, class M>
- bool fromContainerValue(const QV4::Value &object, M CallArgument::*member);
+ bool fromContainerValue(const Value &object, M CallArgument::*member);
union {
float floatValue;
@@ -1356,8 +1352,8 @@ private:
};
}
-static QV4::ReturnedValue CallMethod(const QQmlObjectOrGadget &object, int index, QMetaType returnType, int argCount,
- const QMetaType *argTypes, QV4::ExecutionEngine *engine, QV4::CallData *callArgs,
+static ReturnedValue CallMethod(const QQmlObjectOrGadget &object, int index, QMetaType returnType, int argCount,
+ const QMetaType *argTypes, ExecutionEngine *engine, CallData *callArgs,
QMetaObject::Call callType = QMetaObject::InvokeMetaMethod)
{
if (argCount > 0) {
@@ -1366,7 +1362,7 @@ static QV4::ReturnedValue CallMethod(const QQmlObjectOrGadget &object, int index
args[0].initAsType(returnType);
for (int ii = 0; ii < argCount; ++ii) {
if (!args[ii + 1].fromValue(argTypes[ii], engine,
- callArgs->args[ii].asValue<QV4::Value>())) {
+ callArgs->args[ii].asValue<Value>())) {
qWarning() << QString::fromLatin1("Could not convert argument %1 at").arg(ii);
const StackTrace stack = engine->stackTrace();
for (const StackFrame &frame : stack) {
@@ -1422,7 +1418,7 @@ static QV4::ReturnedValue CallMethod(const QQmlObjectOrGadget &object, int index
The conversion table is copied out of the \l QScript::callQtMethod() function.
*/
-static int MatchScore(const QV4::Value &actual, QMetaType conversionMetaType)
+static int MatchScore(const Value &actual, QMetaType conversionMetaType)
{
const int conversionType = conversionMetaType.id();
if (actual.isNumber()) {
@@ -1481,7 +1477,7 @@ static int MatchScore(const QV4::Value &actual, QMetaType conversionMetaType)
default:
return 10;
}
- } else if (actual.as<QV4::RegExpObject>()) {
+ } else if (actual.as<RegExpObject>()) {
switch (conversionType) {
#if QT_CONFIG(regularexpression)
case QMetaType::QRegularExpression:
@@ -1526,8 +1522,8 @@ static int MatchScore(const QV4::Value &actual, QMetaType conversionMetaType)
return 10;
}
}
- } else if (const QV4::Object *obj = actual.as<QV4::Object>()) {
- if (obj->as<QV4::VariantObject>()) {
+ } else if (const Object *obj = actual.as<Object>()) {
+ if (obj->as<VariantObject>()) {
if (conversionType == qMetaTypeId<QVariant>())
return 0;
if (obj->engine()->toVariant(actual, QMetaType {}).metaType() == conversionMetaType)
@@ -1552,7 +1548,7 @@ static int MatchScore(const QV4::Value &actual, QMetaType conversionMetaType)
return 10;
}
- if (obj->as<QV4::QQmlValueTypeWrapper>()) {
+ if (obj->as<QQmlValueTypeWrapper>()) {
const QVariant v = obj->engine()->toVariant(actual, QMetaType {});
if (v.userType() == conversionType)
return 0;
@@ -1572,18 +1568,18 @@ static int MatchScore(const QV4::Value &actual, QMetaType conversionMetaType)
return 10;
}
-static int numDefinedArguments(QV4::CallData *callArgs)
+static int numDefinedArguments(CallData *callArgs)
{
int numDefinedArguments = callArgs->argc();
while (numDefinedArguments > 0
- && callArgs->args[numDefinedArguments - 1].type() == QV4::StaticValue::Undefined_Type) {
+ && callArgs->args[numDefinedArguments - 1].type() == StaticValue::Undefined_Type) {
--numDefinedArguments;
}
return numDefinedArguments;
}
-static QV4::ReturnedValue CallPrecise(const QQmlObjectOrGadget &object, const QQmlPropertyData &data,
- QV4::ExecutionEngine *engine, QV4::CallData *callArgs,
+static ReturnedValue CallPrecise(const QQmlObjectOrGadget &object, const QQmlPropertyData &data,
+ ExecutionEngine *engine, CallData *callArgs,
QMetaObject::Call callType = QMetaObject::InvokeMetaMethod)
{
QByteArray unknownTypeError;
@@ -1675,7 +1671,7 @@ Resolve the overloaded method to call. The algorithm works conceptually like th
*/
static const QQmlPropertyData *ResolveOverloaded(
const QQmlObjectOrGadget &object, const QQmlPropertyData *methods, int methodCount,
- QV4::ExecutionEngine *engine, QV4::CallData *callArgs)
+ ExecutionEngine *engine, CallData *callArgs)
{
const int argumentCount = callArgs->argc();
const int definedArgumentCount = numDefinedArguments(callArgs);
@@ -1685,8 +1681,8 @@ static const QQmlPropertyData *ResolveOverloaded(
int bestMaxMatchScore = INT_MAX;
int bestSumMatchScore = INT_MAX;
- QV4::Scope scope(engine);
- QV4::ScopedValue v(scope);
+ Scope scope(engine);
+ ScopedValue v(scope);
for (int i = 0; i < methodCount; ++i) {
const QQmlPropertyData *attempt = methods + i;
@@ -1724,7 +1720,7 @@ static const QQmlPropertyData *ResolveOverloaded(
maxMethodMatchScore = 0;
sumMethodMatchScore = 0;
for (int ii = 0; ii < methodArgumentCount; ++ii) {
- const int score = MatchScore((v = QV4::Value::fromStaticValue(callArgs->args[ii])),
+ const int score = MatchScore((v = Value::fromStaticValue(callArgs->args[ii])),
storage[ii]);
maxMethodMatchScore = qMax(maxMethodMatchScore, score);
sumMethodMatchScore += score;
@@ -1888,11 +1884,11 @@ void CallArgument::initAsType(QMetaType metaType)
}
template <class T, class M>
-bool CallArgument::fromContainerValue(const QV4::Value &value, M CallArgument::*member)
+bool CallArgument::fromContainerValue(const Value &value, M CallArgument::*member)
{
- const QV4::Object *object = value.as<QV4::Object>();
+ const Object *object = value.as<Object>();
if (object && object->isListType()) {
- if (T* ptr = static_cast<T *>(QV4::SequencePrototype::getRawContainerPtr(object, type))) {
+ if (T* ptr = static_cast<T *>(SequencePrototype::getRawContainerPtr(object, type))) {
(this->*member) = ptr;
return true;
}
@@ -1901,8 +1897,7 @@ bool CallArgument::fromContainerValue(const QV4::Value &value, M CallArgument::*
return false;
}
-bool CallArgument::fromValue(
- QMetaType metaType, QV4::ExecutionEngine *engine, const QV4::Value &value)
+bool CallArgument::fromValue(QMetaType metaType, ExecutionEngine *engine, const Value &value)
{
if (type != QMetaType::UnknownType)
cleanup();
@@ -1932,12 +1927,12 @@ bool CallArgument::fromValue(
qstringPtr = new (&allocData) QString(value.toQStringNoThrow());
return true;
case QMetaType::QObjectStar:
- if (const QV4::QObjectWrapper *qobjectWrapper = value.as<QV4::QObjectWrapper>()) {
+ if (const QObjectWrapper *qobjectWrapper = value.as<QObjectWrapper>()) {
qobjectPtr = qobjectWrapper->object();
return true;
}
- if (const QV4::QQmlTypeWrapper *qmlTypeWrapper = value.as<QV4::QQmlTypeWrapper>()) {
+ if (const QQmlTypeWrapper *qmlTypeWrapper = value.as<QQmlTypeWrapper>()) {
if (qmlTypeWrapper->isSingleton()) {
// Convert via QVariant below.
// TODO: Can't we just do qobjectPtr = qmlTypeWrapper->object() instead?
@@ -1958,19 +1953,19 @@ bool CallArgument::fromValue(
qvariantPtr = new (&allocData) QVariant(engine->toVariant(value, QMetaType {}));
return true;
case QMetaType::QJsonArray: {
- QV4::Scope scope(engine);
- QV4::ScopedArrayObject a(scope, value);
- jsonArrayPtr = new (&allocData) QJsonArray(QV4::JsonObject::toJsonArray(a));
+ Scope scope(engine);
+ ScopedArrayObject a(scope, value);
+ jsonArrayPtr = new (&allocData) QJsonArray(JsonObject::toJsonArray(a));
return true;
}
case QMetaType::QJsonObject: {
- QV4::Scope scope(engine);
- QV4::ScopedObject o(scope, value);
- jsonObjectPtr = new (&allocData) QJsonObject(QV4::JsonObject::toJsonObject(o));
+ Scope scope(engine);
+ ScopedObject o(scope, value);
+ jsonObjectPtr = new (&allocData) QJsonObject(JsonObject::toJsonObject(o));
return true;
}
case QMetaType::QJsonValue:
- jsonValuePtr = new (&allocData) QJsonValue(QV4::JsonObject::toJsonValue(value));
+ jsonValuePtr = new (&allocData) QJsonValue(JsonObject::toJsonValue(value));
return true;
case QMetaType::Void:
type = QMetaType::UnknownType;
@@ -1986,10 +1981,10 @@ bool CallArgument::fromValue(
if (type == qMetaTypeId<QList<QObject*> >()) {
qlistPtr = new (&allocData) QList<QObject *>();
- QV4::Scope scope(engine);
- QV4::ScopedArrayObject array(scope, value);
+ Scope scope(engine);
+ ScopedArrayObject array(scope, value);
if (array) {
- Scoped<QV4::QObjectWrapper> qobjectWrapper(scope);
+ Scoped<QObjectWrapper> qobjectWrapper(scope);
uint length = array->getLength();
for (uint ii = 0; ii < length; ++ii) {
@@ -2002,7 +1997,7 @@ bool CallArgument::fromValue(
return true;
}
- if (const QV4::QObjectWrapper *qobjectWrapper = value.as<QV4::QObjectWrapper>()) {
+ if (const QObjectWrapper *qobjectWrapper = value.as<QObjectWrapper>()) {
qlistPtr->append(qobjectWrapper->object());
return true;
}
@@ -2080,39 +2075,38 @@ bool CallArgument::fromValue(
return false;
}
-QV4::ReturnedValue CallArgument::toValue(QV4::ExecutionEngine *engine)
+ReturnedValue CallArgument::toValue(ExecutionEngine *engine)
{
-
switch (type) {
case QMetaType::Int:
- return QV4::Encode(int(intValue));
+ return Encode(int(intValue));
case QMetaType::UInt:
- return QV4::Encode((uint)intValue);
+ return Encode((uint)intValue);
case QMetaType::Bool:
- return QV4::Encode(boolValue);
+ return Encode(boolValue);
case QMetaType::Double:
- return QV4::Encode(doubleValue);
+ return Encode(doubleValue);
case QMetaType::Float:
- return QV4::Encode(floatValue);
+ return Encode(floatValue);
case QMetaType::QString:
- return QV4::Encode(engine->newString(*qstringPtr));
+ return Encode(engine->newString(*qstringPtr));
case QMetaType::QByteArray:
- return QV4::Encode(engine->newArrayBuffer(*qbyteArrayPtr));
+ return Encode(engine->newArrayBuffer(*qbyteArrayPtr));
case QMetaType::QObjectStar:
if (qobjectPtr)
QQmlData::get(qobjectPtr, true)->setImplicitDestructible();
- return QV4::QObjectWrapper::wrap(engine, qobjectPtr);
+ return QObjectWrapper::wrap(engine, qobjectPtr);
case QMetaType::QJsonArray:
- return QV4::JsonObject::fromJsonArray(engine, *jsonArrayPtr);
+ return JsonObject::fromJsonArray(engine, *jsonArrayPtr);
case QMetaType::QJsonObject:
- return QV4::JsonObject::fromJsonObject(engine, *jsonObjectPtr);
+ return JsonObject::fromJsonObject(engine, *jsonObjectPtr);
case QMetaType::QJsonValue:
- return QV4::JsonObject::fromJsonValue(engine, *jsonValuePtr);
+ return JsonObject::fromJsonValue(engine, *jsonValuePtr);
case QMetaType::QVariant:
case QVariantWrappedType: {
- QV4::Scope scope(engine);
- QV4::ScopedValue rv(scope, scope.engine->fromVariant(*qvariantPtr));
- QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, rv);
+ Scope scope(engine);
+ ScopedValue rv(scope, scope.engine->fromVariant(*qvariantPtr));
+ Scoped<QObjectWrapper> qobjectWrapper(scope, rv);
if (!!qobjectWrapper) {
if (QObject *object = qobjectWrapper->object())
QQmlData::get(object, true)->setImplicitDestructible();
@@ -2133,17 +2127,17 @@ QV4::ReturnedValue CallArgument::toValue(QV4::ExecutionEngine *engine)
// XXX Can this be made more by using Array as a prototype and implementing
// directly against QList<QObject*>?
QList<QObject *> &list = *qlistPtr;
- QV4::Scope scope(engine);
- QV4::ScopedArrayObject array(scope, engine->newArrayObject());
+ Scope scope(engine);
+ ScopedArrayObject array(scope, engine->newArrayObject());
array->arrayReserve(list.count());
- QV4::ScopedValue v(scope);
+ ScopedValue v(scope);
for (int ii = 0; ii < list.count(); ++ii)
- array->arrayPut(ii, (v = QV4::QObjectWrapper::wrap(engine, list.at(ii))));
+ array->arrayPut(ii, (v = QObjectWrapper::wrap(engine, list.at(ii))));
array->setArrayLengthUnchecked(list.count());
return array.asReturnedValue();
}
- return QV4::Encode::undefined();
+ return Encode::undefined();
}
ReturnedValue QObjectMethod::create(ExecutionContext *scope, QObject *object, int index)
@@ -2212,7 +2206,7 @@ void Heap::QObjectMethod::ensureMethodsCache()
}
}
-QV4::ReturnedValue QObjectMethod::method_toString(QV4::ExecutionEngine *engine) const
+ReturnedValue QObjectMethod::method_toString(ExecutionEngine *engine) const
{
QString result;
if (const QMetaObject *metaObject = d()->metaObject()) {
@@ -2234,7 +2228,7 @@ QV4::ReturnedValue QObjectMethod::method_toString(QV4::ExecutionEngine *engine)
return engine->newString(result)->asReturnedValue();
}
-QV4::ReturnedValue QObjectMethod::method_destroy(QV4::ExecutionEngine *engine, const Value *args, int argc) const
+ReturnedValue QObjectMethod::method_destroy(ExecutionEngine *engine, const Value *args, int argc) const
{
if (!d()->object())
return Encode::undefined();
@@ -2288,10 +2282,10 @@ ReturnedValue QObjectMethod::callInternal(const Value *thisObject, const Value *
// The method might change the value.
const auto doCall = [&](const auto &call) {
if (!method->isConstant()) {
- QV4::Scoped<QQmlValueTypeReference> valueTypeReference(
+ Scoped<QQmlValueTypeReference> valueTypeReference(
scope, d()->valueTypeWrapper.get());
if (valueTypeReference) {
- QV4::ScopedValue rv(scope, call());
+ ScopedValue rv(scope, call());
valueTypeReference->d()->writeBack();
return rv->asReturnedValue();
}
@@ -2308,7 +2302,7 @@ ReturnedValue QObjectMethod::callInternal(const Value *thisObject, const Value *
if (method->isV4Function()) {
return doCall([&]() {
- QV4::ScopedValue rv(scope, QV4::Value::undefinedValue());
+ ScopedValue rv(scope, Value::undefinedValue());
QQmlV4Function func(callData, rv, v4);
QQmlV4Function *funcptr = &func;
@@ -2362,8 +2356,8 @@ void Heap::QMetaObjectWrapper::ensureConstructorsCache() {
ReturnedValue QMetaObjectWrapper::create(ExecutionEngine *engine, const QMetaObject* metaObject) {
- QV4::Scope scope(engine);
- Scoped<QMetaObjectWrapper> mo(scope, engine->memoryManager->allocate<QV4::QMetaObjectWrapper>(metaObject)->asReturnedValue());
+ Scope scope(engine);
+ Scoped<QMetaObjectWrapper> mo(scope, engine->memoryManager->allocate<QMetaObjectWrapper>(metaObject)->asReturnedValue());
mo->init(engine);
return mo->asReturnedValue();
}
@@ -2450,17 +2444,17 @@ void QmlSignalHandler::initProto(ExecutionEngine *engine)
Scope scope(engine);
ScopedObject o(scope, engine->newObject());
- QV4::ScopedString connect(scope, engine->newIdentifier(QStringLiteral("connect")));
- QV4::ScopedString disconnect(scope, engine->newIdentifier(QStringLiteral("disconnect")));
- o->put(connect, QV4::ScopedValue(scope, engine->functionPrototype()->get(connect)));
- o->put(disconnect, QV4::ScopedValue(scope, engine->functionPrototype()->get(disconnect)));
+ ScopedString connect(scope, engine->newIdentifier(QStringLiteral("connect")));
+ ScopedString disconnect(scope, engine->newIdentifier(QStringLiteral("disconnect")));
+ o->put(connect, ScopedValue(scope, engine->functionPrototype()->get(connect)));
+ o->put(disconnect, ScopedValue(scope, engine->functionPrototype()->get(disconnect)));
- engine->jsObjects[QV4::ExecutionEngine::SignalHandlerProto] = o->d();
+ engine->jsObjects[ExecutionEngine::SignalHandlerProto] = o->d();
}
void MultiplyWrappedQObjectMap::insert(QObject *key, Heap::Object *value)
{
- QHash<QObject*, QV4::WeakValue>::operator[](key).set(value->internalClass->engine, value);
+ QHash<QObject*, WeakValue>::operator[](key).set(value->internalClass->engine, value);
connect(key, SIGNAL(destroyed(QObject*)), this, SLOT(removeDestroyedObject(QObject*)));
}
@@ -2469,7 +2463,7 @@ void MultiplyWrappedQObjectMap::insert(QObject *key, Heap::Object *value)
MultiplyWrappedQObjectMap::Iterator MultiplyWrappedQObjectMap::erase(MultiplyWrappedQObjectMap::Iterator it)
{
disconnect(it.key(), SIGNAL(destroyed(QObject*)), this, SLOT(removeDestroyedObject(QObject*)));
- return QHash<QObject*, QV4::WeakValue>::erase(it);
+ return QHash<QObject*, WeakValue>::erase(it);
}
void MultiplyWrappedQObjectMap::remove(QObject *key)
@@ -2490,9 +2484,11 @@ void MultiplyWrappedQObjectMap::mark(QObject *key, MarkStack *markStack)
void MultiplyWrappedQObjectMap::removeDestroyedObject(QObject *object)
{
- QHash<QObject*, QV4::WeakValue>::remove(object);
+ QHash<QObject*, WeakValue>::remove(object);
}
+} // namespace QV4
+
QT_END_NAMESPACE
#include "moc_qv4qobjectwrapper_p.cpp"