diff options
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmlcompiler.cpp | 24 | ||||
-rw-r--r-- | src/qml/qml/qqmlcompiler_p.h | 1 | ||||
-rw-r--r-- | src/qml/qml/qqmlcustomparser.cpp | 17 | ||||
-rw-r--r-- | src/qml/qml/qqmlcustomparser_p.h | 8 | ||||
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 5 |
5 files changed, 20 insertions, 35 deletions
diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp index 069345ecd3..a0c1bbcdda 100644 --- a/src/qml/qml/qqmlcompiler.cpp +++ b/src/qml/qml/qqmlcompiler.cpp @@ -2665,30 +2665,6 @@ bool QQmlCompiler::testQualifiedEnumAssignment(QQmlScript::Property *prop, return true; } -int QQmlCompiler::bindingIdentifier(const QString &name, const Variant &value, const BindingContext &ctxt) -{ - JSBindingReference *reference = pool->New<JSBindingReference>(); - reference->expression = value; - reference->property = pool->New<Property>(); - reference->property->setName(name); - reference->value = 0; - reference->bindingContext = ctxt; - reference->bindingContext.owner++; - // Unfortunately this is required for example for PropertyChanges where the bindings - // will be executed in the dynamic scope of the target, so we can't resolve any lookups - // at run-time. - reference->disableLookupAcceleration = true; - - const int id = output->customParserBindings.count(); - output->customParserBindings.append(0); // Filled in later. - reference->customParserBindingsIndex = id; - - compileState->totalBindingsCount++; - compileState->bindings.prepend(reference); - - return id; -} - QQmlBinding::Identifier QQmlCompiler::bindingIdentifier(const Variant &value, const QString &name, QQmlCustomParser *customParser) { JSBindingReference *reference = pool->New<JSBindingReference>(); diff --git a/src/qml/qml/qqmlcompiler_p.h b/src/qml/qml/qqmlcompiler_p.h index 58943b206a..0feebed93d 100644 --- a/src/qml/qml/qqmlcompiler_p.h +++ b/src/qml/qml/qqmlcompiler_p.h @@ -349,7 +349,6 @@ public: static bool isAttachedPropertyName(const QHashedStringRef &); static bool isSignalPropertyName(const QHashedStringRef &); - int bindingIdentifier(const QString &name, const QQmlScript::Variant& value, const QQmlCompilerTypes::BindingContext &ctxt); // for QQmlCustomParser::bindingIndex virtual QQmlBinding::Identifier bindingIdentifier(const QQmlScript::Variant&value, const QString&name, QQmlCustomParser *customParser); virtual const QQmlImports &imports() const { return unit->imports(); } diff --git a/src/qml/qml/qqmlcustomparser.cpp b/src/qml/qml/qqmlcustomparser.cpp index ca23451774..90bd2fd875 100644 --- a/src/qml/qml/qqmlcustomparser.cpp +++ b/src/qml/qml/qqmlcustomparser.cpp @@ -230,13 +230,6 @@ void QQmlCustomParser::clearErrors() exceptions.clear(); } -QByteArray QQmlCustomParser::compile(const QV4::CompiledData::QmlUnit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &bindings) -{ - Q_UNUSED(qmlUnit) - Q_UNUSED(bindings) - return QByteArray(); -} - /*! Reports an error with the given \a description. @@ -349,6 +342,16 @@ QQmlBinding::Identifier QQmlCustomParser::bindingIdentifier(const QQmlScript::Va return compiler->bindingIdentifier(value, name, this); } +QQmlBinding::Identifier QQmlCustomParser::bindingIdentifier(const QV4::CompiledData::Binding *binding) +{ + return compiler->bindingIdentifier(binding, this); +} + +AST::Node *QQmlCustomParser::astForBinding(int scriptIndex) const +{ + return compiler->astForBinding(scriptIndex); +} + struct StaticQtMetaObject : public QObject { static const QMetaObject *get() diff --git a/src/qml/qml/qqmlcustomparser_p.h b/src/qml/qml/qqmlcustomparser_p.h index 2f1a9ddec8..b4d716b240 100644 --- a/src/qml/qml/qqmlcustomparser_p.h +++ b/src/qml/qml/qqmlcustomparser_p.h @@ -117,6 +117,9 @@ struct QQmlCustomParserCompilerBackend const QMetaObject *resolveType(const QString& name) const; virtual QQmlBinding::Identifier bindingIdentifier(const QQmlScript::Variant&, const QString&, QQmlCustomParser *) { return QQmlBinding::Invalid; } + virtual QQmlBinding::Identifier bindingIdentifier(const QV4::CompiledData::Binding *, QQmlCustomParser *) { return QQmlBinding::Invalid; } + + virtual QQmlJS::AST::Node *astForBinding(int) const { return 0; } }; class Q_QML_PRIVATE_EXPORT QQmlCustomParser @@ -137,7 +140,7 @@ public: Flags flags() const { return m_flags; } virtual QByteArray compile(const QList<QQmlCustomParserProperty> &)=0; - virtual QByteArray compile(const QV4::CompiledData::QmlUnit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &bindings); // ### make pure virtual + virtual QByteArray compile(const QV4::CompiledData::QmlUnit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &bindings) = 0; virtual void setCustomData(QObject *, const QByteArray &)=0; QList<QQmlError> errors() const { return exceptions; } @@ -154,6 +157,9 @@ protected: const QMetaObject *resolveType(const QString&) const; QQmlBinding::Identifier bindingIdentifier(const QQmlScript::Variant&, const QString&); + QQmlBinding::Identifier bindingIdentifier(const QV4::CompiledData::Binding *binding); + + QQmlJS::AST::Node *astForBinding(int scriptIndex) const; private: QList<QQmlError> exceptions; diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index b1f4a8e1bf..2cacb0e546 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -997,8 +997,9 @@ QObject *QmlObjectCreator::createInstance(int index, QObject *parent) context->setIdProperty(idEntry.value(), instance); if (customParser) { - QByteArray data = compiledData->customParserData.value(index); - customParser->setCustomData(instance, data); + QHash<int, QByteArray>::ConstIterator entry = compiledData->customParserData.find(index); + if (entry != compiledData->customParserData.constEnd()) + customParser->setCustomData(instance, *entry); } if (isComponent) |