diff options
author | Michael Brasser <mbrasser@ford.com> | 2018-05-22 14:07:14 -0500 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-05-23 08:00:41 +0000 |
commit | 1aecb24682075cbb99f21a367c399387b12257d0 (patch) | |
tree | a870380fb8fbddc4c2d63d201bef2d0d1717485b /src/qml | |
parent | e50eeaf3a2cb1ec8d4d96b695245b86782284d81 (diff) |
Ensure we restore QML-defined enums
This code path was previously missed, leading to some AOT-compiled types
generating errors of the form:
Unable to assign [undefined] to int
[ChangeLog][QtQml] Fix QML declared enums with CONFIG+=qtquickcompiler.
Change-Id: Ib46a2b2505aa3863f091a6ccdebf8425e62fc38f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/compiler/qqmlirbuilder.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp index 1b07fda1fd..8a1b3744ee 100644 --- a/src/qml/compiler/qqmlirbuilder.cpp +++ b/src/qml/compiler/qqmlirbuilder.cpp @@ -2414,6 +2414,22 @@ QmlIR::Object *IRLoader::loadObject(const QV4::CompiledData::Object *serializedO object->qmlSignals->append(s); } + for (uint i = 0; i < serializedObject->nEnums; ++i) { + const QV4::CompiledData::Enum *serializedEnum = serializedObject->enumAt(i); + QmlIR::Enum *e = pool->New<QmlIR::Enum>(); + e->nameIndex = serializedEnum->nameIndex; + e->location = serializedEnum->location; + e->enumValues = pool->New<QmlIR::PoolList<QmlIR::EnumValue> >(); + + for (uint i = 0; i < serializedEnum->nEnumValues; ++i) { + QmlIR::EnumValue *v = pool->New<QmlIR::EnumValue>(); + *static_cast<QV4::CompiledData::EnumValue*>(v) = *serializedEnum->enumValueAt(i); + e->enumValues->append(v); + } + + object->qmlEnums->append(e); + } + const QV4::CompiledData::Property *serializedProperty = serializedObject->propertyTable(); for (uint i = 0; i < serializedObject->nProperties; ++i, ++serializedProperty) { QmlIR::Property *p = pool->New<QmlIR::Property>(); |