aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp15
-rw-r--r--src/qml/compiler/qqmltypecompiler_p.h6
-rw-r--r--src/qml/qml/qqmlcustomparser.cpp29
-rw-r--r--src/qml/qml/qqmlcustomparser_p.h16
4 files changed, 10 insertions, 56 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index 80ffafda72..7f62446c22 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -1719,17 +1719,6 @@ const QQmlImports &QQmlPropertyValidator::imports() const
return *compiler->imports();
}
-QString QQmlPropertyValidator::bindingAsString(int objectIndex, const QV4::CompiledData::Binding *binding) const
-{
- const QmlIR::Object *object = compiler->qmlObjects()->value(objectIndex);
- if (!object)
- return QString();
- int reverseIndex = object->runtimeFunctionIndices->indexOf(binding->value.compiledScriptIndex);
- if (reverseIndex == -1)
- return QString();
- return compiler->bindingAsString(object, reverseIndex);
-}
-
typedef QVarLengthArray<const QV4::CompiledData::Binding *, 8> GroupPropertyVector;
struct BindingFinder
@@ -1998,10 +1987,10 @@ bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledD
if (customParser && !customBindings.isEmpty()) {
customParser->clearErrors();
- customParser->compiler = this;
+ customParser->validator = this;
customParser->imports = compiler->imports();
customParser->verifyBindings(qmlUnit, customBindings);
- customParser->compiler = 0;
+ customParser->validator = 0;
customParser->imports = (QQmlImports*)0;
customParserBindingsPerObject->insert(objectIndex, customParserBindings);
const QList<QQmlError> parserErrors = customParser->errors();
diff --git a/src/qml/compiler/qqmltypecompiler_p.h b/src/qml/compiler/qqmltypecompiler_p.h
index 75987af656..cbc68280b7 100644
--- a/src/qml/compiler/qqmltypecompiler_p.h
+++ b/src/qml/compiler/qqmltypecompiler_p.h
@@ -264,7 +264,7 @@ protected:
QHash<int, QHash<int, int> > *objectIndexToIdPerComponent;
};
-class QQmlPropertyValidator : public QQmlCompilePass, public QQmlCustomParserCompilerBackend
+class QQmlPropertyValidator : public QQmlCompilePass
{
Q_DECLARE_TR_FUNCTIONS(QQmlPropertyValidator)
public:
@@ -272,9 +272,7 @@ public:
bool validate();
- // Re-implemented for QQmlCustomParser
- virtual const QQmlImports &imports() const;
- virtual QString bindingAsString(int objectIndex, const QV4::CompiledData::Binding *binding) const;
+ const QQmlImports &imports() const;
private:
bool validateObject(int objectIndex, const QV4::CompiledData::Binding *instantiatingBinding, bool populatingValueTypeGroupProperty = false) const;
diff --git a/src/qml/qml/qqmlcustomparser.cpp b/src/qml/qml/qqmlcustomparser.cpp
index ebca9d2718..ec88ee015a 100644
--- a/src/qml/qml/qqmlcustomparser.cpp
+++ b/src/qml/qml/qqmlcustomparser.cpp
@@ -34,6 +34,7 @@
#include "qqmlcustomparser_p.h"
#include "qqmlcompiler_p.h"
+#include <private/qqmltypecompiler_p.h>
#include <QtCore/qdebug.h>
@@ -159,34 +160,8 @@ int QQmlCustomParser::evaluateEnum(const QByteArray& script, bool *ok) const
*/
const QMetaObject *QQmlCustomParser::resolveType(const QString& name) const
{
- return compiler->resolveType(name);
-}
-
-int QQmlCustomParserCompilerBackend::evaluateEnum(const QString &scope, const QByteArray &enumValue, bool *ok) const
-{
- Q_ASSERT_X(ok, "QQmlCompiler::evaluateEnum", "ok must not be a null pointer");
- *ok = false;
-
- if (scope != QLatin1String("Qt")) {
- QQmlType *type = 0;
- imports().resolveType(scope, &type, 0, 0, 0);
- return type ? type->enumValue(QHashedCStringRef(enumValue.constData(), enumValue.length()), ok) : -1;
- }
-
- const QMetaObject *mo = StaticQtMetaObject::get();
- int i = mo->enumeratorCount();
- while (i--) {
- int v = mo->enumerator(i).keyToValue(enumValue.constData(), ok);
- if (*ok)
- return v;
- }
- return -1;
-}
-
-const QMetaObject *QQmlCustomParserCompilerBackend::resolveType(const QString &name) const
-{
QQmlType *qmltype = 0;
- if (!imports().resolveType(name, &qmltype, 0, 0, 0))
+ if (!validator->imports().resolveType(name, &qmltype, 0, 0, 0))
return 0;
if (!qmltype)
return 0;
diff --git a/src/qml/qml/qqmlcustomparser_p.h b/src/qml/qml/qqmlcustomparser_p.h
index 88282b1bbc..dd461ba299 100644
--- a/src/qml/qml/qqmlcustomparser_p.h
+++ b/src/qml/qml/qqmlcustomparser_p.h
@@ -55,15 +55,7 @@
QT_BEGIN_NAMESPACE
class QQmlCompiledData;
-
-struct QQmlCustomParserCompilerBackend
-{
- virtual ~QQmlCustomParserCompilerBackend() {}
- virtual const QQmlImports &imports() const = 0;
-
- int evaluateEnum(const QString &scope, const QByteArray& enumValue, bool *ok) const;
- const QMetaObject *resolveType(const QString& name) const;
-};
+class QQmlPropertyValidator;
class Q_QML_PRIVATE_EXPORT QQmlCustomParser
{
@@ -75,8 +67,8 @@ public:
};
Q_DECLARE_FLAGS(Flags, Flag)
- QQmlCustomParser() : compiler(0), m_flags(NoFlag) {}
- QQmlCustomParser(Flags f) : compiler(0), m_flags(f) {}
+ QQmlCustomParser() : validator(0), m_flags(NoFlag) {}
+ QQmlCustomParser(Flags f) : validator(0), m_flags(f) {}
virtual ~QQmlCustomParser() {}
void clearErrors();
@@ -100,7 +92,7 @@ protected:
private:
QList<QQmlError> exceptions;
- const QQmlCustomParserCompilerBackend *compiler;
+ const QQmlPropertyValidator *validator;
Flags m_flags;
QBiPointer<const QQmlImports, QQmlTypeNameCache> imports;
friend class QQmlPropertyValidator;