diff options
Diffstat (limited to 'src/qml/compiler/qv4compileddata_p.h')
-rw-r--r-- | src/qml/compiler/qv4compileddata_p.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h index 359a92c166..2c0320f7f1 100644 --- a/src/qml/compiler/qv4compileddata_p.h +++ b/src/qml/compiler/qv4compileddata_p.h @@ -72,7 +72,7 @@ QT_BEGIN_NAMESPACE // Bump this whenever the compiler data structures change in an incompatible way. -#define QV4_DATA_STRUCTURE_VERSION 0x16 +#define QV4_DATA_STRUCTURE_VERSION 0x17 class QIODevice; class QQmlPropertyCache; @@ -717,6 +717,7 @@ struct Unit quint32_le offsetToJSClassTable; qint32_le indexOfRootFunction; quint32_le sourceFileIndex; + quint32_le finalUrlIndex; /* QML specific fields */ quint32_le nImports; @@ -724,6 +725,8 @@ struct Unit quint32_le nObjects; quint32_le offsetToObjects; + quint32_le padding; + const Import *importAt(int idx) const { return reinterpret_cast<const Import*>((reinterpret_cast<const char *>(this)) + offsetToImports + idx * sizeof(Import)); } @@ -788,7 +791,7 @@ struct Unit } }; -static_assert(sizeof(Unit) == 136, "Unit structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target"); +static_assert(sizeof(Unit) == 144, "Unit structure needs to have the expected size to be binary compatible on disk when generated by host compiler and loaded by target"); struct TypeReference { @@ -918,13 +921,28 @@ public: ExecutionEngine *engine = nullptr; QQmlEnginePrivate *qmlEngine = nullptr; // only used in QML environment for composite types, not in plain QJSEngine case. + // url() and fileName() shall be used to load the actual QML/JS code or to show errors or + // warnings about that code. They include any potential URL interceptions and thus represent the + // "physical" location of the code. + // + // finalUrl() and finalUrlString() shall be used to resolve further URLs referred to in the code + // They are _not_ intercepted and thus represent the "logical" name for the code. + QString fileName() const { return data->stringAt(data->sourceFileIndex); } + QString finalUrlString() const { return data->stringAt(data->finalUrlIndex); } QUrl url() const { if (m_url.isNull) m_url = QUrl(fileName()); return m_url; } + QUrl finalUrl() const + { + if (m_finalUrl.isNull) + m_finalUrl = QUrl(finalUrlString()); + return m_finalUrl; + } QV4::Lookup *runtimeLookups = nullptr; QV4::InternalClass **runtimeClasses = nullptr; QVector<QV4::Function *> runtimeFunctions; mutable QQmlNullableValue<QUrl> m_url; + mutable QQmlNullableValue<QUrl> m_finalUrl; // QML specific fields QQmlPropertyCacheVector propertyCaches; |