diff options
author | Glenn Watson <glenn.watson@nokia.com> | 2012-07-24 11:41:50 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-08 07:55:19 +0200 |
commit | 6ebf215fdaf2d757ab90ae4d46c4b938e978e2dc (patch) | |
tree | 515da352f1cc4d5567b6d93f0b19952b2e27d705 /src/qml/qml/v4/qv4irbuilder.cpp | |
parent | 92562eacbc3c614a83a734f1108ed7df02415eae (diff) |
Add type name to singleton (module api) implementations.
This change renames the previous module api implementation
to singleton types.
When a singleton type is registered, a type name must be provided
that is used when accessing the API from QML. This makes the
implementation more consistent with the rest of QML.
Task-number: QTBUG-26549
Change-Id: Iab0bb1ccf516bd3ae20aee562a64d22976e0aecd
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Diffstat (limited to 'src/qml/qml/v4/qv4irbuilder.cpp')
-rw-r--r-- | src/qml/qml/v4/qv4irbuilder.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/qml/qml/v4/qv4irbuilder.cpp b/src/qml/qml/v4/qv4irbuilder.cpp index 79090b4269..93c552173f 100644 --- a/src/qml/qml/v4/qv4irbuilder.cpp +++ b/src/qml/qml/v4/qv4irbuilder.cpp @@ -446,15 +446,15 @@ bool QV4IRBuilder::visit(AST::IdentifierExpression *ast) if (r.type) { _expr.code = _block->ATTACH_TYPE(name, r.type, IR::Name::ScopeStorage, line, column); } else if (r.importNamespace) { - QQmlMetaType::ModuleApiInstance *moduleApi = m_expression->importCache->moduleApi(r.importNamespace); - if (moduleApi && moduleApi->instanceMetaObject) { - // Note: we don't need to check moduleApi->qobjectCallback here, since - // we did that check in registerModuleApi() in qqmlmetatype.cpp. - // We cannot create the QObject Module Api Instance here, + QQmlMetaType::SingletonInstance *singletonType = m_expression->importCache->singletonType(r.importNamespace); + if (singletonType && singletonType->instanceMetaObject) { + // Note: we don't need to check singletonType->qobjectCallback here, since + // we did that check in registerSingletonType() in qqmlmetatype.cpp. + // We cannot create the QObject Singleton Type Instance here, // as we might be running in a loader thread. - // Thus, V4 can only handle bindings which use Module APIs which + // Thus, V4 can only handle bindings which use Singleton Types which // were registered with the templated registration function. - _expr.code = _block->MODULE_OBJECT(name, moduleApi->instanceMetaObject, IR::Name::MemberStorage, line, column); + _expr.code = _block->MODULE_OBJECT(name, singletonType->instanceMetaObject, IR::Name::MemberStorage, line, column); } } // We don't support anything else |