diff options
Diffstat (limited to 'src/qml/jsruntime/qv4script.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4script.cpp | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index bf8582a7b0..d045e097a2 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -193,55 +193,4 @@ QQmlRefPointer<QV4::CompiledData::CompilationUnit> Script::precompile( return cg.generateCompilationUnit(/*generate unit data*/false); } -Script *Script::createFromFileOrCache( - ExecutionEngine *engine, QmlContext *qmlContext, const QString &fileName, - const QUrl &originalUrl, QString *error) -{ - if (error) - error->clear(); - - QQmlMetaType::CachedUnitLookupError cacheError = QQmlMetaType::CachedUnitLookupError::NoError; - const ExecutionEngine::DiskCacheOptions options = engine->diskCacheOptions(); - if (const QQmlPrivate::CachedQmlUnit *cachedUnit - = (options & ExecutionEngine::DiskCache::Aot) - ? QQmlMetaType::findCachedCompilationUnit( - originalUrl, - (options & ExecutionEngine::DiskCache::AotByteCode) - ? QQmlMetaType::AcceptUntyped - : QQmlMetaType::RequireFullyTyped, - &cacheError) - : nullptr) { - QQmlRefPointer<QV4::ExecutableCompilationUnit> jsUnit - = engine->insertCompilationUnit( - QQml::makeRefPointer<QV4::CompiledData::CompilationUnit>( - cachedUnit->qmlData, cachedUnit->aotCompiledFunctions)); - return new QV4::Script(engine, qmlContext, jsUnit); - } - - QFile f(fileName); - if (!f.open(QIODevice::ReadOnly)) { - if (error) { - if (cacheError == QQmlMetaType::CachedUnitLookupError::VersionMismatch) { - *error = originalUrl.toString() - + QString::fromUtf8(" was compiled ahead of time with an incompatible " - "version of Qt and the original source code cannot be " - "found. Please recompile"); - } else { - *error = QString::fromUtf8("Error opening source file %1: %2") - .arg(originalUrl.toString()).arg(f.errorString()); - } - } - return nullptr; - } - - QByteArray data = f.readAll(); - QString sourceCode = QString::fromUtf8(data); - - auto result = new QV4::Script( - engine, qmlContext, /*parseAsBinding*/false, sourceCode, originalUrl.toString()); - result->m_contextType = QV4::Compiler::ContextType::ScriptImportedByQML; - result->parse(); - return result; -} - QT_END_NAMESPACE |
