Simplify object to id-in-context mapping
By storing the calculated integer id for an id-named object in CompiledData::Object we can simplify the code and replace a hash table with a plain vector. Change-Id: I4a84cdd00e98766d603d152e5a6574b232771a02 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This commit is contained in:
parent
899c1ef0f7
commit
8457ca1b3d
|
@ -72,14 +72,15 @@ using namespace QmlIR;
|
|||
return false; \
|
||||
}
|
||||
|
||||
void Object::init(QQmlJS::MemoryPool *pool, int typeNameIndex, int id, const QQmlJS::AST::SourceLocation &loc)
|
||||
void Object::init(QQmlJS::MemoryPool *pool, int typeNameIndex, int idIndex, const QQmlJS::AST::SourceLocation &loc)
|
||||
{
|
||||
inheritedTypeNameIndex = typeNameIndex;
|
||||
|
||||
location.line = loc.startLine;
|
||||
location.column = loc.startColumn;
|
||||
|
||||
idIndex = id;
|
||||
idNameIndex = idIndex;
|
||||
id = -1;
|
||||
indexOfDefaultPropertyOrAlias = -1;
|
||||
defaultPropertyIsAlias = false;
|
||||
flags = QV4::CompiledData::Object::NoFlag;
|
||||
|
@ -1237,10 +1238,10 @@ bool IRBuilder::setId(const QQmlJS::AST::SourceLocation &idLocation, QQmlJS::AST
|
|||
if (illegalNames.contains(idQString))
|
||||
COMPILE_EXCEPTION(loc, tr( "ID illegally masks global JavaScript property"));
|
||||
|
||||
if (_object->idIndex != emptyStringIndex)
|
||||
if (_object->idNameIndex != emptyStringIndex)
|
||||
COMPILE_EXCEPTION(idLocation, tr("Property value set multiple times"));
|
||||
|
||||
_object->idIndex = registerString(idQString);
|
||||
_object->idNameIndex = registerString(idQString);
|
||||
_object->locationOfIdProperty.line = idLocation.startLine;
|
||||
_object->locationOfIdProperty.column = idLocation.startColumn;
|
||||
|
||||
|
@ -1421,7 +1422,8 @@ QV4::CompiledData::Unit *QmlUnitGenerator::generate(Document &output)
|
|||
objectToWrite->indexOfDefaultPropertyOrAlias = o->indexOfDefaultPropertyOrAlias;
|
||||
objectToWrite->defaultPropertyIsAlias = o->defaultPropertyIsAlias;
|
||||
objectToWrite->flags = o->flags;
|
||||
objectToWrite->idIndex = o->idIndex;
|
||||
objectToWrite->idNameIndex = o->idNameIndex;
|
||||
objectToWrite->id = o->id;
|
||||
objectToWrite->location = o->location;
|
||||
objectToWrite->locationOfIdProperty = o->locationOfIdProperty;
|
||||
|
||||
|
|
|
@ -279,7 +279,8 @@ struct Q_QML_PRIVATE_EXPORT Object
|
|||
Q_DECLARE_TR_FUNCTIONS(Object)
|
||||
public:
|
||||
quint32 inheritedTypeNameIndex;
|
||||
quint32 idIndex;
|
||||
quint32 idNameIndex;
|
||||
int id;
|
||||
int indexOfDefaultPropertyOrAlias;
|
||||
bool defaultPropertyIsAlias;
|
||||
int flags;
|
||||
|
@ -302,7 +303,7 @@ public:
|
|||
// specified object. Used for declarations inside group properties.
|
||||
Object *declarationsOverride;
|
||||
|
||||
void init(QQmlJS::MemoryPool *pool, int typeNameIndex, int id, const QQmlJS::AST::SourceLocation &location = QQmlJS::AST::SourceLocation());
|
||||
void init(QQmlJS::MemoryPool *pool, int typeNameIndex, int idIndex, const QQmlJS::AST::SourceLocation &location = QQmlJS::AST::SourceLocation());
|
||||
|
||||
QString sanityCheckFunctionNames(const QSet<QString> &illegalNames, QQmlJS::AST::SourceLocation *errorLocation);
|
||||
|
||||
|
|
|
@ -346,14 +346,14 @@ const QQmlPropertyCacheVector &QQmlTypeCompiler::propertyCaches() const
|
|||
return compiledData->propertyCaches;
|
||||
}
|
||||
|
||||
QHash<int, int> *QQmlTypeCompiler::objectIndexToIdForRoot()
|
||||
QVector<quint32> *QQmlTypeCompiler::namedObjectsInRootScope()
|
||||
{
|
||||
return &compiledData->objectIndexToIdForRoot;
|
||||
return &compiledData->namedObjectsInRootScope;
|
||||
}
|
||||
|
||||
QHash<int, QHash<int, int> > *QQmlTypeCompiler::objectIndexToIdPerComponent()
|
||||
QHash<int, QVector<quint32>> *QQmlTypeCompiler::namedObjectsPerComponent()
|
||||
{
|
||||
return &compiledData->objectIndexToIdPerComponent;
|
||||
return &compiledData->namedObjectsPerComponent;
|
||||
}
|
||||
|
||||
QHash<int, QBitArray> *QQmlTypeCompiler::customParserBindings()
|
||||
|
@ -1324,11 +1324,11 @@ QQmlComponentAndAliasResolver::QQmlComponentAndAliasResolver(QQmlTypeCompiler *t
|
|||
, qmlObjects(typeCompiler->qmlObjects())
|
||||
, indexOfRootObject(typeCompiler->rootObjectIndex())
|
||||
, _componentIndex(-1)
|
||||
, _objectIndexToIdInScope(0)
|
||||
, _namedObjectsInScope(0)
|
||||
, resolvedTypes(typeCompiler->resolvedTypes())
|
||||
, propertyCaches(typeCompiler->propertyCaches())
|
||||
, objectIndexToIdForRoot(typeCompiler->objectIndexToIdForRoot())
|
||||
, objectIndexToIdPerComponent(typeCompiler->objectIndexToIdPerComponent())
|
||||
, namedObjectsInRootScope(typeCompiler->namedObjectsInRootScope())
|
||||
, namedObjectsPerComponent(typeCompiler->namedObjectsPerComponent())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1475,7 +1475,7 @@ bool QQmlComponentAndAliasResolver::resolve()
|
|||
_componentIndex = i;
|
||||
_idToObjectIndex.clear();
|
||||
|
||||
_objectIndexToIdInScope = &(*objectIndexToIdPerComponent)[componentRoots.at(i)];
|
||||
_namedObjectsInScope = &(*namedObjectsPerComponent)[componentRoots.at(i)];
|
||||
|
||||
_objectsWithAliases.clear();
|
||||
|
||||
|
@ -1489,7 +1489,7 @@ bool QQmlComponentAndAliasResolver::resolve()
|
|||
// Collect ids and aliases for root
|
||||
_componentIndex = -1;
|
||||
_idToObjectIndex.clear();
|
||||
_objectIndexToIdInScope = objectIndexToIdForRoot;
|
||||
_namedObjectsInScope = namedObjectsInRootScope;
|
||||
_objectsWithAliases.clear();
|
||||
|
||||
collectIdsAndAliases(indexOfRootObject);
|
||||
|
@ -1505,15 +1505,16 @@ bool QQmlComponentAndAliasResolver::resolve()
|
|||
|
||||
bool QQmlComponentAndAliasResolver::collectIdsAndAliases(int objectIndex)
|
||||
{
|
||||
const QmlIR::Object *obj = qmlObjects->at(objectIndex);
|
||||
QmlIR::Object *obj = qmlObjects->at(objectIndex);
|
||||
|
||||
if (obj->idIndex != 0) {
|
||||
if (_idToObjectIndex.contains(obj->idIndex)) {
|
||||
if (obj->idNameIndex != 0) {
|
||||
if (_idToObjectIndex.contains(obj->idNameIndex)) {
|
||||
recordError(obj->locationOfIdProperty, tr("id is not unique"));
|
||||
return false;
|
||||
}
|
||||
_idToObjectIndex.insert(obj->idIndex, objectIndex);
|
||||
_objectIndexToIdInScope->insert(objectIndex, _objectIndexToIdInScope->count());
|
||||
_idToObjectIndex.insert(obj->idNameIndex, objectIndex);
|
||||
obj->id = _namedObjectsInScope->count();
|
||||
_namedObjectsInScope->append(objectIndex);
|
||||
}
|
||||
|
||||
if (obj->aliasCount() > 0)
|
||||
|
@ -1557,8 +1558,9 @@ bool QQmlComponentAndAliasResolver::resolveAliases()
|
|||
}
|
||||
Q_ASSERT(!(alias->flags & QV4::CompiledData::Alias::Resolved));
|
||||
alias->flags |= QV4::CompiledData::Alias::Resolved;
|
||||
Q_ASSERT(_objectIndexToIdInScope->contains(targetObjectIndex));
|
||||
alias->targetObjectId = _objectIndexToIdInScope->value(targetObjectIndex);
|
||||
const QmlIR::Object *targetObject = qmlObjects->at(targetObjectIndex);
|
||||
Q_ASSERT(targetObject->id >= 0);
|
||||
alias->targetObjectId = targetObject->id;
|
||||
|
||||
const QString aliasPropertyValue = stringAt(alias->propertyNameIndex);
|
||||
|
||||
|
@ -1718,7 +1720,7 @@ struct BindingFinder
|
|||
bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledData::Binding *instantiatingBinding, bool populatingValueTypeGroupProperty) const
|
||||
{
|
||||
const QV4::CompiledData::Object *obj = qmlUnit->objectAt(objectIndex);
|
||||
if (obj->idIndex != 0)
|
||||
if (obj->idNameIndex != 0)
|
||||
_seenObjectWithId = true;
|
||||
|
||||
if (obj->flags & QV4::CompiledData::Object::IsComponent) {
|
||||
|
@ -1959,7 +1961,7 @@ bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledD
|
|||
}
|
||||
}
|
||||
|
||||
if (obj->idIndex) {
|
||||
if (obj->idNameIndex) {
|
||||
bool notInRevision = false;
|
||||
collectedBindingPropertyData << propertyResolver.property(QStringLiteral("id"), ¬InRevision);
|
||||
}
|
||||
|
@ -2376,17 +2378,17 @@ QQmlJSCodeGenerator::QQmlJSCodeGenerator(QQmlTypeCompiler *typeCompiler, QmlIR::
|
|||
|
||||
bool QQmlJSCodeGenerator::generateCodeForComponents()
|
||||
{
|
||||
const QHash<int, QHash<int, int> > &objectIndexToIdPerComponent = *compiler->objectIndexToIdPerComponent();
|
||||
for (QHash<int, QHash<int, int> >::ConstIterator component = objectIndexToIdPerComponent.constBegin(), end = objectIndexToIdPerComponent.constEnd();
|
||||
const QHash<int, QVector<quint32>> &namedObjectsPerComponent = *compiler->namedObjectsPerComponent();
|
||||
for (QHash<int, QVector<quint32>>::ConstIterator component = namedObjectsPerComponent.constBegin(), end = namedObjectsPerComponent.constEnd();
|
||||
component != end; ++component) {
|
||||
if (!compileComponent(component.key(), component.value()))
|
||||
return false;
|
||||
}
|
||||
|
||||
return compileComponent(compiler->rootObjectIndex(), *compiler->objectIndexToIdForRoot());
|
||||
return compileComponent(compiler->rootObjectIndex(), *compiler->namedObjectsInRootScope());
|
||||
}
|
||||
|
||||
bool QQmlJSCodeGenerator::compileComponent(int contextObject, const QHash<int, int> &objectIndexToId)
|
||||
bool QQmlJSCodeGenerator::compileComponent(int contextObject, const QVector<quint32> &namedObjects)
|
||||
{
|
||||
const QmlIR::Object *obj = qmlObjects.at(contextObject);
|
||||
if (obj->flags & QV4::CompiledData::Object::IsComponent) {
|
||||
|
@ -2397,17 +2399,13 @@ bool QQmlJSCodeGenerator::compileComponent(int contextObject, const QHash<int, i
|
|||
}
|
||||
|
||||
QmlIR::JSCodeGen::ObjectIdMapping idMapping;
|
||||
if (!objectIndexToId.isEmpty()) {
|
||||
idMapping.reserve(objectIndexToId.count());
|
||||
|
||||
for (QHash<int, int>::ConstIterator idIt = objectIndexToId.constBegin(), end = objectIndexToId.constEnd();
|
||||
idIt != end; ++idIt) {
|
||||
|
||||
const int objectIndex = idIt.key();
|
||||
idMapping.reserve(namedObjects.count());
|
||||
for (int i = 0; i < namedObjects.count(); ++i) {
|
||||
const int objectIndex = namedObjects.at(i);
|
||||
QmlIR::JSCodeGen::IdMapping m;
|
||||
const QmlIR::Object *obj = qmlObjects.at(objectIndex);
|
||||
m.name = stringAt(obj->idIndex);
|
||||
m.idIndex = idIt.value();
|
||||
m.name = stringAt(obj->idNameIndex);
|
||||
m.idIndex = obj->id;
|
||||
m.type = propertyCaches.at(objectIndex).data();
|
||||
|
||||
QQmlCompiledData::TypeReference *tref = resolvedTypes.value(obj->inheritedTypeNameIndex);
|
||||
|
@ -2416,7 +2414,6 @@ bool QQmlJSCodeGenerator::compileComponent(int contextObject, const QHash<int, i
|
|||
|
||||
idMapping << m;
|
||||
}
|
||||
}
|
||||
v4CodeGen->beginContextScope(idMapping, propertyCaches.at(contextObject).data());
|
||||
|
||||
if (!compileJavaScriptCodeInObjectsRecursively(contextObject, contextObject))
|
||||
|
|
|
@ -101,8 +101,8 @@ public:
|
|||
int rootObjectIndex() const;
|
||||
void setPropertyCaches(const QQmlPropertyCacheVector &caches);
|
||||
const QQmlPropertyCacheVector &propertyCaches() const;
|
||||
QHash<int, int> *objectIndexToIdForRoot();
|
||||
QHash<int, QHash<int, int> > *objectIndexToIdPerComponent();
|
||||
QVector<quint32> *namedObjectsInRootScope();
|
||||
QHash<int, QVector<quint32> > *namedObjectsPerComponent();
|
||||
QHash<int, QBitArray> *customParserBindings();
|
||||
QQmlJS::MemoryPool *memoryPool();
|
||||
QStringRef newStringRef(const QString &string);
|
||||
|
@ -275,13 +275,13 @@ protected:
|
|||
|
||||
int _componentIndex;
|
||||
QHash<int, int> _idToObjectIndex;
|
||||
QHash<int, int> *_objectIndexToIdInScope;
|
||||
QVector<quint32> *_namedObjectsInScope;
|
||||
QList<int> _objectsWithAliases;
|
||||
|
||||
QHash<int, QQmlCompiledData::TypeReference*> *resolvedTypes;
|
||||
QQmlPropertyCacheVector propertyCaches;
|
||||
QHash<int, int> *objectIndexToIdForRoot;
|
||||
QHash<int, QHash<int, int> > *objectIndexToIdPerComponent;
|
||||
QVector<quint32> *namedObjectsInRootScope;
|
||||
QHash<int, QVector<quint32>> *namedObjectsPerComponent;
|
||||
};
|
||||
|
||||
class QQmlPropertyValidator : public QQmlCompilePass
|
||||
|
@ -324,7 +324,7 @@ public:
|
|||
bool generateCodeForComponents();
|
||||
|
||||
private:
|
||||
bool compileComponent(int componentRoot, const QHash<int, int> &objectIndexToId);
|
||||
bool compileComponent(int componentRoot, const QVector<quint32> &namedObjects);
|
||||
bool compileJavaScriptCodeInObjectsRecursively(int objectIndex, int scopeObjectIndex);
|
||||
|
||||
const QHash<int, QQmlCompiledData::TypeReference*> &resolvedTypes;
|
||||
|
|
|
@ -400,8 +400,9 @@ struct Object
|
|||
// object. For grouped properties the type name will be empty and for attached properties
|
||||
// it will be the name of the attached type.
|
||||
quint32 inheritedTypeNameIndex;
|
||||
quint32 idIndex;
|
||||
qint32 flags : 31;
|
||||
quint32 idNameIndex;
|
||||
qint32 id : 16;
|
||||
qint32 flags : 15;
|
||||
quint32 defaultPropertyIsAlias : 1;
|
||||
qint32 indexOfDefaultPropertyOrAlias; // -1 means no default property declared in this object
|
||||
quint32 nFunctions;
|
||||
|
|
|
@ -131,9 +131,9 @@ public:
|
|||
QList<QQmlScriptData *> scripts;
|
||||
|
||||
QQmlRefPointer<QV4::CompiledData::CompilationUnit> compilationUnit;
|
||||
// index in first hash is component index, hash inside maps from object index in that scope to integer id
|
||||
QHash<int, QHash<int, int> > objectIndexToIdPerComponent;
|
||||
QHash<int, int> objectIndexToIdForRoot;
|
||||
// index in first hash is component index, vector inside contains object indices of objects with id property
|
||||
QHash<int, QVector<quint32>> namedObjectsPerComponent;
|
||||
QVector<quint32> namedObjectsInRootScope;
|
||||
// hash key is object index, value is indicies of bindings covered by custom parser
|
||||
QHash<int, QBitArray> customParserBindings;
|
||||
QHash<int, QBitArray> deferredBindingsPerObject; // index is object index
|
||||
|
|
|
@ -760,12 +760,12 @@ void QQmlContextData::setIdProperty(int idx, QObject *obj)
|
|||
idValues[idx].context = this;
|
||||
}
|
||||
|
||||
void QQmlContextData::setIdPropertyData(const QHash<int, int> &data)
|
||||
void QQmlContextData::setNamedObjects(const QVector<quint32> &objects)
|
||||
{
|
||||
Q_ASSERT(objectIndexToId.isEmpty());
|
||||
objectIndexToId = data;
|
||||
Q_ASSERT(namedObjects.isEmpty());
|
||||
namedObjects = objects;
|
||||
Q_ASSERT(propertyNameCache.isEmpty());
|
||||
idValueCount = data.count();
|
||||
idValueCount = objects.count();
|
||||
idValues = new ContextGuard[idValueCount];
|
||||
}
|
||||
|
||||
|
@ -808,13 +808,12 @@ QV4::IdentifierHash<int> &QQmlContextData::propertyNames() const
|
|||
{
|
||||
if (propertyNameCache.isEmpty()) {
|
||||
propertyNameCache = QV4::IdentifierHash<int>(QV8Engine::getV4(engine->handle()));
|
||||
for (QHash<int, int>::ConstIterator it = objectIndexToId.cbegin(), end = objectIndexToId.cend();
|
||||
it != end; ++it) {
|
||||
const QV4::CompiledData::Object *obj = typeCompilationUnit->data->objectAt(it.key());
|
||||
const QString name = typeCompilationUnit->data->stringAt(obj->idIndex);
|
||||
propertyNameCache.add(name, it.value());
|
||||
for (int i = 0; i < namedObjects.count(); ++i) {
|
||||
const QV4::CompiledData::Object *obj = typeCompilationUnit->data->objectAt(namedObjects.at(i));
|
||||
const QString name = typeCompilationUnit->data->stringAt(obj->idNameIndex);
|
||||
propertyNameCache.add(name, obj->id);
|
||||
}
|
||||
objectIndexToId.clear();
|
||||
namedObjects.clear();
|
||||
}
|
||||
return propertyNameCache;
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ public:
|
|||
// Compilation unit for contexts that belong to a compiled type.
|
||||
QQmlRefPointer<QV4::CompiledData::CompilationUnit> typeCompilationUnit;
|
||||
|
||||
mutable QHash<int, int> objectIndexToId;
|
||||
mutable QVector<quint32> namedObjects;
|
||||
mutable QV4::IdentifierHash<int> propertyNameCache;
|
||||
QV4::IdentifierHash<int> &propertyNames() const;
|
||||
|
||||
|
@ -201,7 +201,7 @@ public:
|
|||
ContextGuard *idValues;
|
||||
int idValueCount;
|
||||
void setIdProperty(int, QObject *);
|
||||
void setIdPropertyData(const QHash<int, int> &);
|
||||
void setNamedObjects(const QVector<quint32> &objects);
|
||||
|
||||
// Linked contexts. this owns linkedContext.
|
||||
QQmlContextData *linkedContext;
|
||||
|
|
|
@ -158,10 +158,10 @@ QObject *QQmlObjectCreator::create(int subComponentIndex, QObject *parent, QQmlI
|
|||
int objectToCreate;
|
||||
|
||||
if (subComponentIndex == -1) {
|
||||
objectIndexToId = compiledData->objectIndexToIdForRoot;
|
||||
namedObjects = compiledData->namedObjectsInRootScope;
|
||||
objectToCreate = qmlUnit->indexOfRootObject;
|
||||
} else {
|
||||
objectIndexToId = compiledData->objectIndexToIdPerComponent[subComponentIndex];
|
||||
namedObjects = compiledData->namedObjectsPerComponent[subComponentIndex];
|
||||
const QV4::CompiledData::Object *compObj = qmlUnit->objectAt(subComponentIndex);
|
||||
objectToCreate = compObj->bindingTable()->value.objectIndex;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ QObject *QQmlObjectCreator::create(int subComponentIndex, QObject *parent, QQmlI
|
|||
if (topLevelCreator)
|
||||
sharedState->allJavaScriptObjects = scope.alloc(compiledData->totalObjectCount);
|
||||
|
||||
context->setIdPropertyData(objectIndexToId);
|
||||
context->setNamedObjects(namedObjects);
|
||||
|
||||
if (subComponentIndex == -1 && compiledData->scripts.count()) {
|
||||
QV4::ScopedObject scripts(scope, v4->newArrayObject(compiledData->scripts.count()));
|
||||
|
@ -637,7 +637,7 @@ void QQmlObjectCreator::setupBindings(const QBitArray &bindingsToSkip)
|
|||
|
||||
const QV4::CompiledData::BindingPropertyData &propertyData = compiledData->compilationUnit->bindingPropertyDataPerObject.at(_compiledObjectIndex);
|
||||
|
||||
if (_compiledObject->idIndex) {
|
||||
if (_compiledObject->idNameIndex) {
|
||||
const QQmlPropertyData *idProperty = propertyData.last();
|
||||
Q_ASSERT(!idProperty || !idProperty->isValid() || idProperty->name(_qobject) == QLatin1String("id"));
|
||||
if (idProperty && idProperty->isValid() && idProperty->isWritable() && idProperty->propType == QMetaType::QString) {
|
||||
|
@ -645,7 +645,7 @@ void QQmlObjectCreator::setupBindings(const QBitArray &bindingsToSkip)
|
|||
idBinding.propertyNameIndex = 0; // Not used
|
||||
idBinding.flags = 0;
|
||||
idBinding.type = QV4::CompiledData::Binding::Type_String;
|
||||
idBinding.stringIndex = _compiledObject->idIndex;
|
||||
idBinding.stringIndex = _compiledObject->idNameIndex;
|
||||
idBinding.location = _compiledObject->location; // ###
|
||||
setPropertyValue(idProperty, &idBinding);
|
||||
}
|
||||
|
@ -1005,11 +1005,10 @@ void QQmlObjectCreator::recordError(const QV4::CompiledData::Location &location,
|
|||
errors << error;
|
||||
}
|
||||
|
||||
void QQmlObjectCreator::registerObjectWithContextById(int objectIndex, QObject *instance) const
|
||||
void QQmlObjectCreator::registerObjectWithContextById(const QV4::CompiledData::Object *object, QObject *instance) const
|
||||
{
|
||||
QHash<int, int>::ConstIterator idEntry = objectIndexToId.find(objectIndex);
|
||||
if (idEntry != objectIndexToId.constEnd())
|
||||
context->setIdProperty(idEntry.value(), instance);
|
||||
if (object->id >= 0)
|
||||
context->setIdProperty(object->id, instance);
|
||||
}
|
||||
|
||||
QV4::Heap::QmlContext *QQmlObjectCreator::currentQmlContext()
|
||||
|
@ -1146,7 +1145,7 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo
|
|||
}
|
||||
|
||||
if (isComponent) {
|
||||
registerObjectWithContextById(index, instance);
|
||||
registerObjectWithContextById(obj, instance);
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
@ -1298,7 +1297,7 @@ bool QQmlObjectCreator::populateInstance(int index, QObject *instance, QObject *
|
|||
vmeMetaObject = QQmlVMEMetaObject::get(_qobject);
|
||||
}
|
||||
|
||||
registerObjectWithContextById(_compiledObjectIndex, _qobject);
|
||||
registerObjectWithContextById(_compiledObject, _qobject);
|
||||
|
||||
qSwap(_propertyCache, cache);
|
||||
qSwap(_vmeMetaObject, vmeMetaObject);
|
||||
|
|
|
@ -122,7 +122,7 @@ private:
|
|||
QString stringAt(int idx) const { return qmlUnit->stringAt(idx); }
|
||||
void recordError(const QV4::CompiledData::Location &location, const QString &description);
|
||||
|
||||
void registerObjectWithContextById(int objectIndex, QObject *instance) const;
|
||||
void registerObjectWithContextById(const QV4::CompiledData::Object *object, QObject *instance) const;
|
||||
|
||||
QV4::Heap::QmlContext *currentQmlContext();
|
||||
|
||||
|
@ -143,7 +143,7 @@ private:
|
|||
QQmlContextData *context;
|
||||
const QHash<int, QQmlCompiledData::TypeReference*> &resolvedTypes;
|
||||
const QQmlPropertyCacheVector &propertyCaches;
|
||||
QHash<int, int> objectIndexToId;
|
||||
QVector<quint32> namedObjects;
|
||||
QExplicitlySharedDataPointer<QQmlObjectCreatorSharedState> sharedState;
|
||||
bool topLevelCreator;
|
||||
void *activeVMEDataForRootContext;
|
||||
|
|
|
@ -2401,7 +2401,7 @@ bool QQmlListModelParser::verifyProperty(const QV4::CompiledData::Unit *qmlUnit,
|
|||
listElementTypeName = objName; // cache right name for next time
|
||||
}
|
||||
|
||||
if (!qmlUnit->stringAt(target->idIndex).isEmpty()) {
|
||||
if (!qmlUnit->stringAt(target->idNameIndex).isEmpty()) {
|
||||
error(target->locationOfIdProperty, QQmlListModel::tr("ListElement: cannot use reserved \"id\" property"));
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue