diff options
| author | Olivier De Cannière <olivier.decanniere@qt.io> | 2025-03-05 11:16:59 +0100 |
|---|---|---|
| committer | Olivier De Cannière <olivier.decanniere@qt.io> | 2025-03-06 19:23:04 +0100 |
| commit | 321a05e10bb0d1548f49f8dd077cae41ca490e44 (patch) | |
| tree | 77a12d4e262d55232374e541b5bbbeb363079127 /src/qml/compiler/qqmlirbuilder.cpp | |
| parent | 25e1f9b8999d748dc959e29519fa9671487bc346 (diff) | |
QV4: Reserve a bit in CompiledData::Property
The bit is taken from nameIndex. It should have more than enough
capacity with 31 bits. The reserved bit will be used as a flag in
subsequent commits.
A more typed and centrally enforced aproach to the indexes will be
necessary in the future.
Change-Id: Ia7c686affba6d5320e674dd3f32b7c59b6321e22
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/compiler/qqmlirbuilder.cpp')
| -rw-r--r-- | src/qml/compiler/qqmlirbuilder.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp index 0afe8a2eb9..a706285bcf 100644 --- a/src/qml/compiler/qqmlirbuilder.cpp +++ b/src/qml/compiler/qqmlirbuilder.cpp @@ -36,7 +36,7 @@ void Object::simplifyRequiredProperties() { if (required.isEmpty()) return; for (auto it = this->propertiesBegin(); it != this->propertiesEnd(); ++it) { - auto requiredIt = required.find(it->nameIndex); + auto requiredIt = required.find(it->nameIndex()); if (requiredIt != required.end()) { it->setIsRequired(true); required.erase(requiredIt); @@ -194,11 +194,11 @@ QString Object::appendProperty(Property *prop, const QString &propertyName, bool target = this; for (Property *p = target->properties->first; p; p = p->next) - if (p->nameIndex == prop->nameIndex) + if (p->nameIndex() == prop->nameIndex()) return tr("Duplicate property name"); for (Alias *a = target->aliases->first; a; a = a->next) - if (a->nameIndex() == prop->nameIndex) + if (a->nameIndex() == prop->nameIndex()) return tr("Property duplicates alias name"); if (propertyName.constData()->isUpper()) @@ -228,7 +228,7 @@ QString Object::appendAlias(Alias *alias, const QString &aliasName, bool isDefau return tr("Duplicate alias name"); const auto aliasSameAsProperty = std::find_if(target->properties->begin(), target->properties->end(), [&alias](const Property &targetProp){ - return targetProp.nameIndex == alias->nameIndex(); + return targetProp.nameIndex() == alias->nameIndex(); }); if (aliasSameAsProperty != target->properties->end()) @@ -1089,7 +1089,7 @@ bool IRBuilder::visit(QQmlJS::AST::UiPublicMember *node) } const QString propName = name.toString(); - property->nameIndex = registerString(propName); + property->setNameIndex(registerString(propName)); QQmlJS::SourceLocation loc = node->firstSourceLocation(); property->location.set(loc.startLine, loc.startColumn); @@ -1116,7 +1116,7 @@ bool IRBuilder::visit(QQmlJS::AST::UiPublicMember *node) QQmlJS::AST::Node::accept(node->binding, this); } else if (node->statement) { if (!isRedundantNullInitializerForPropertyDeclaration(_propertyDeclaration, node->statement)) - appendBinding(node->identifierToken, node->identifierToken, _propertyDeclaration->nameIndex, node->statement, node); + appendBinding(node->identifierToken, node->identifierToken, _propertyDeclaration->nameIndex(), node->statement, node); } qSwap(_propertyDeclaration, property); } |
