diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-11-08 10:28:30 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-11-08 12:32:01 +0100 |
commit | 0a27a14ec1879096e5fffca75b3bd107b813db87 (patch) | |
tree | 2e4332c9545af969903cb9c8bd619f2adc53f5a8 /src/qml/compiler | |
parent | b853a1e1b003d4dc01884201c09c2fcbf75f2cf6 (diff) | |
parent | 7bedd55551fbe95355b0db11f9d576924e829f9d (diff) |
Merge remote-tracking branch 'origin/dev' into new-backend
Change-Id: I1a49b4a242ed0764101521d06ec612e96bff0e4c
Diffstat (limited to 'src/qml/compiler')
-rw-r--r-- | src/qml/compiler/qqmlirbuilder.cpp | 2 | ||||
-rw-r--r-- | src/qml/compiler/qqmltypecompiler.cpp | 2 | ||||
-rw-r--r-- | src/qml/compiler/qv4compileddata.cpp | 2 | ||||
-rw-r--r-- | src/qml/compiler/qv4compileddata_p.h | 5 |
4 files changed, 9 insertions, 2 deletions
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp index 1c88eab2a8..128eb2c720 100644 --- a/src/qml/compiler/qqmlirbuilder.cpp +++ b/src/qml/compiler/qqmlirbuilder.cpp @@ -1074,6 +1074,8 @@ void IRBuilder::setBindingValue(QV4::CompiledData::Binding *binding, QQmlJS::AST // If it wasn't a translation binding, a normal script binding will be generated // below. } + } else if (QQmlJS::AST::cast<QQmlJS::AST::FunctionExpression *>(expr)) { + binding->flags |= QV4::CompiledData::Binding::IsFunctionExpression; } else if (QQmlJS::AST::UnaryMinusExpression *unaryMinus = QQmlJS::AST::cast<QQmlJS::AST::UnaryMinusExpression *>(expr)) { if (QQmlJS::AST::NumericLiteral *lit = QQmlJS::AST::cast<QQmlJS::AST::NumericLiteral *>(unaryMinus->expression)) { binding->type = QV4::CompiledData::Binding::Type_Number; diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp index 2bee00552f..97ca597953 100644 --- a/src/qml/compiler/qqmltypecompiler.cpp +++ b/src/qml/compiler/qqmltypecompiler.cpp @@ -402,7 +402,7 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio const QString &originalPropertyName = stringAt(binding->propertyNameIndex); auto *typeRef = resolvedTypes.value(obj->inheritedTypeNameIndex); - const QQmlType type = typeRef->type; + const QQmlType type = typeRef ? typeRef->type : QQmlType(); if (type.isValid()) { COMPILE_EXCEPTION(binding, tr("\"%1.%2\" is not available in %3 %4.%5.").arg(typeName).arg(originalPropertyName).arg(type.module()).arg(type.majorVersion()).arg(type.minorVersion())); } else { diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index 79a6018734..3a1fd7fce5 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -206,7 +206,7 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) void CompilationUnit::unlink() { if (engine) - engine->compilationUnits.erase(engine->compilationUnits.find(this)); + nextCompilationUnit.remove(); if (isRegisteredWithEngine) { Q_ASSERT(data && propertyCaches.count() > 0 && propertyCaches.at(/*root object*/0)); diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h index dd651191ab..55c5f1f29f 100644 --- a/src/qml/compiler/qv4compileddata_p.h +++ b/src/qml/compiler/qv4compileddata_p.h @@ -66,6 +66,7 @@ #ifndef V4_BOOTSTRAP #include <private/qqmltypenamecache_p.h> #include <private/qqmlpropertycache_p.h> +#include "private/qintrusivelist_p.h" #endif QT_BEGIN_NAMESPACE @@ -312,6 +313,7 @@ struct Q_QML_PRIVATE_EXPORT Binding IsBindingToAlias = 0x40, IsDeferredBinding = 0x80, IsCustomParserBinding = 0x100, + IsFunctionExpression = 0x200 }; union { @@ -379,6 +381,8 @@ struct Q_QML_PRIVATE_EXPORT Binding return false; } + bool isFunctionExpression() const { return (flags & IsFunctionExpression); } + static QString escapedString(const QString &string); bool containsTranslations() const { return type == Type_Translation || type == Type_TranslationById; } @@ -912,6 +916,7 @@ public: QV4::CompiledData::Unit *createUnitData(QmlIR::Document *irDocument); #ifndef V4_BOOTSTRAP + QIntrusiveListNode nextCompilationUnit; ExecutionEngine *engine = nullptr; QQmlEnginePrivate *qmlEngine = nullptr; // only used in QML environment for composite types, not in plain QJSEngine case. |