4#include <private/qqmlengine_p.h>
5#include <private/qqmlirbuilder_p.h>
6#include <private/qqmlscriptblob_p.h>
7#include <private/qqmlscriptdata_p.h>
8#include <private/qqmlsourcecoordinate_p.h>
9#include <private/qqmlcontextdata_p.h>
10#include <private/qv4runtimecodegen_p.h>
11#include <private/qv4script_p.h>
13#include <QtCore/qloggingcategory.h>
41 if (unit->loadFromDisk(
url(),
data.sourceTimeStamp(), &
error)) {
42 initializeFromCompilationUnit(unit);
51 setError(QQmlTypeLoader::tr(
"File was compiled ahead of time with an incompatible version of Qt and the original file cannot be found. Please recompile"));
53 setError(QQmlTypeLoader::tr(
"No such file or directory"));
59 if (!
error.isEmpty()) {
69 data.sourceTimeStamp(), &diagnostics);
103 if (executableUnit->saveToDisk(
url(), &errorString)) {
105 if (!executableUnit->loadFromDisk(
url(),
data.sourceTimeStamp(), &
error)) {
109 qCDebug(DBG_DISK_CACHE()) <<
"Error saving cached version of"
110 << executableUnit->fileName() <<
"to disk:" << errorString;
114 initializeFromCompilationUnit(executableUnit);
129 for (
int ii = 0; ii < m_scripts.size(); ++ii) {
150 for (
int scriptIndex = 0; scriptIndex < m_scripts.size(); ++scriptIndex) {
179 ref.qualifier = qualifier;
180 ref.nameSpace = nameSpace;
191 m_scriptData->m_precompiledScript = unit;
205 error.setLine(import->location.line());
206 error.setColumn(import->location.column());
216 v4->injectCompiledModule(unit);
220 if (module.compiled || module.native)
244 m_scriptData->m_loaded =
true;
qsizetype size() const noexcept
bool isEmpty() const noexcept
void prepend(rvalue_ref t)
bool isError() const
Returns true if the status is Error.
bool isCompleteOrError() const
Returns true if the status is Complete or Error.
void addDependency(QQmlDataBlob *)
Wait for blob to become complete or to error.
QList< QQmlError > errors() const
Return the errors on this blob.
QUrl url() const
Returns the physical url of the data.
QQmlTypeLoader * typeLoader() const
QUrl finalUrl() const
Returns the logical URL to be used for resolving further URLs referred to in the code.
QString finalUrlString() const
Returns the finalUrl() as a string.
void setError(const QQmlError &)
Mark this blob as having errors.
QString urlString() const
static QList< QQmlError > qmlErrorFromDiagnostics(const QString &fileName, const QList< QQmlJS::DiagnosticMessage > &diagnosticMessages)
static QV4::ExecutionEngine * getV4Engine(QQmlEngine *e)
The QQmlError class encapsulates a QML error.
void populateCache(QQmlTypeNameCache *cache) const
void setBaseUrl(const QUrl &url, const QString &urlString=QString())
Sets the base URL to be used for all relative file imports added.
void setDirectives(Directives *directives)
QQmlRefPointer< T > & adopt(T *)
Takes ownership of other.
void scriptImported(const QQmlRefPointer< QQmlScriptBlob > &blob, const QV4::CompiledData::Location &location, const QString &qualifier, const QString &nameSpace) override
QQmlRefPointer< QQmlScriptData > scriptData() const
~QQmlScriptBlob() override
void initializeFromCachedUnit(const QQmlPrivate::CachedQmlUnit *unit) override
void dataReceived(const SourceCodeData &) override
Invoked when data for the blob is received.
QString stringAt(int index) const override
void done() override
Invoked once data has either been received or a network error occurred, and all dependencies are comp...
QVector< QQmlRefPointer< QQmlScriptBlob > > scripts
QQmlRefPointer< QQmlTypeNameCache > typeNameCache
bool readCacheFile() const
bool addImport(const QV4::CompiledData::Import *import, QQmlImports::ImportFlags, QList< QQmlError > *errors)
bool writeCacheFile() const
QQmlMetaType::CachedUnitLookupError m_cachedUnitStatus
QQmlRefPointer< QQmlImports > m_importCache
The QQmlTypeLoader class abstracts loading files and their dependencies over the network.
QQmlRefPointer< QQmlScriptBlob > getScript(const QUrl &unNormalizedUrl)
Return a QQmlScriptBlob for url.
void add(const QHashedString &name, int sciptIndex=-1, const QHashedString &nameSpace=QHashedString())
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isNull() const
Returns true if this string is null; otherwise returns false.
static QV4::CompiledData::CompilationUnit compileModule(bool debugMode, const QString &url, const QString &sourceCode, const QDateTime &sourceTimeStamp, QList< QQmlJS::DiagnosticMessage > *diagnostics)
static QQmlRefPointer< ExecutableCompilationUnit > create()
void set(ExecutionEngine *engine, const Value &value)
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLsizei GLsizei GLchar * source
GLsizei const GLchar *const * path
int qmlConvertSourceCoordinate< quint32, int >(quint32 n)
QUrl url("example.com")
[constructor-url-reference]
QNetworkRequest request(url)
const AOTCompiledFunction * aotCompiledFunctions
const QV4::CompiledData::Unit * qmlData
QQmlRefPointer< QQmlScriptBlob > script
QV4::CompiledData::Location location
QString stringAt(uint index) const
QDateTime sourceTimeStamp
static QV4::CompiledData::CompilationUnit precompile(QV4::Compiler::Module *module, QQmlJS::Engine *jsEngine, Compiler::JSUnitGenerator *unitGenerator, const QString &fileName, const QString &finalUrl, const QString &source, QList< QQmlError > *reportedErrors=nullptr, QV4::Compiler::ContextType contextType=QV4::Compiler::ContextType::Global)
QV4::Compiler::Module jsModule
QV4::CompiledData::CompilationUnit javaScriptCompilationUnit
QV4::Compiler::JSUnitGenerator jsGenerator
QQmlJS::Engine jsParserEngine
void generate(Document &output, const QV4::CompiledData::DependentTypesHasher &dependencyHasher=QV4::CompiledData::DependentTypesHasher())