diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-12-06 11:29:43 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-06 21:51:04 +0100 |
commit | 32b7e01558e0d3c50dd10f846182fe5dc09686e9 (patch) | |
tree | 0d3cfeaca25f3e670edb6a848e94eca197477839 /src/qml/qml | |
parent | 24e2b39e7a06687322a18a158a083eb51a7c0dca (diff) |
Clean up handling of illegal names and enable in new compiler
Access to the identifier hash may not be thread-safe from the loader thread, so
use a QSet copy instead (which is cheap because we don't detach).
This also enables the checking for illegal types again.
Change-Id: I8c3ec1fd0fc01cce3269e206f479a90bdbbc89dd
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmlpropertycache.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 5 | ||||
-rw-r--r-- | src/qml/qml/v8/qv8engine.cpp | 5 | ||||
-rw-r--r-- | src/qml/qml/v8/qv8engine_p.h | 4 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index 6c40557886..d026b95201 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -1140,7 +1140,7 @@ QString QQmlPropertyCache::signalParameterStringForJS(QQmlEngine *engine, const { QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine); bool unnamedParameter = false; - const QV4::IdentifierHash<bool> &illegalNames = ep->v8engine()->illegalNames(); + const QSet<QString> &illegalNames = ep->v8engine()->illegalNames(); QString error; QString parameters; diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 6eda55e35b..60fa00a5c9 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -2154,8 +2154,9 @@ void QQmlTypeData::dataReceived(const Data &data) if (data.isFile()) preparseData = data.asFile()->metaData(QLatin1String("qml:preparse")); if (m_useNewCompiler) { - parsedQML.reset(new QtQml::ParsedQML(QV8Engine::getV4(typeLoader()->engine())->debugger != 0)); - QQmlCodeGenerator compiler; + QQmlEngine *qmlEngine = typeLoader()->engine(); + parsedQML.reset(new QtQml::ParsedQML(QV8Engine::getV4(qmlEngine)->debugger != 0)); + QQmlCodeGenerator compiler(QV8Engine::get(qmlEngine)->illegalNames()); if (!compiler.generateFromQml(code, finalUrl(), finalUrlString(), parsedQML.data())) { setError(compiler.errors); return; diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index 88d56bf676..1e7fdbc316 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -361,7 +361,7 @@ QNetworkAccessManager *QV8Engine::networkAccessManager() return QQmlEnginePrivate::get(m_engine)->getNetworkAccessManager(); } -const QV4::IdentifierHash<bool> &QV8Engine::illegalNames() const +const QSet<QString> &QV8Engine::illegalNames() const { return m_illegalNames; } @@ -437,9 +437,8 @@ void QV8Engine::initializeGlobal() qt_add_sqlexceptions(m_v4Engine); { - m_illegalNames = QV4::IdentifierHash<bool>(m_v4Engine); for (uint i = 0; i < m_v4Engine->globalObject->internalClass->size; ++i) - m_illegalNames.add(m_v4Engine->globalObject->internalClass->nameMap.at(i)->toQString(), true); + m_illegalNames.insert(m_v4Engine->globalObject->internalClass->nameMap.at(i)->toQString()); } { diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h index e37b0d4920..5d1005b479 100644 --- a/src/qml/qml/v8/qv8engine_p.h +++ b/src/qml/qml/v8/qv8engine_p.h @@ -217,7 +217,7 @@ public: virtual QNetworkAccessManager *networkAccessManager(); // Return the list of illegal id names (the names of the properties on the global object) - const QV4::IdentifierHash<bool> &illegalNames() const; + const QSet<QString> &illegalNames() const; void gc(); @@ -268,7 +268,7 @@ protected: QVector<Deletable *> m_extensionData; Deletable *m_listModelData; - QV4::IdentifierHash<bool> m_illegalNames; + QSet<QString> m_illegalNames; QElapsedTimer m_time; QHash<QString, qint64> m_startedTimers; |