QQmlJSScope: Rename parentPropertyName and defaultPropertyName

The parent and default properties also hold for subclasses, but the
names exposed here are only the own properties. Make this visible.

Change-Id: I6d3e2a278b5e0e29fee6d257f2f68eb3acd50dea
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
This commit is contained in:
Ulf Hermann 2021-06-29 14:52:49 +02:00
parent b2ee7364be
commit af7aae4da5
4 changed files with 9 additions and 9 deletions

View File

@ -409,7 +409,7 @@ void QQmlJSImportVisitor::processDefaultProperties()
bool isComponent = false;
for (const auto *s = it.key().get(); s; s = s->baseType().get()) {
defaultPropertyName = s->defaultPropertyName();
defaultPropertyName = s->ownDefaultPropertyName();
if (!defaultPropertyName.isEmpty()) {
scopeOfDefaultProperty = s;
break;
@ -1011,7 +1011,7 @@ bool QQmlJSImportVisitor::visit(UiPublicMember *publicMember)
}
prop.setAnnotations(parseAnnotations(publicMember->annotations));
if (publicMember->isDefaultMember)
m_currentScope->setDefaultPropertyName(prop.propertyName());
m_currentScope->setOwnDefaultPropertyName(prop.propertyName());
prop.setIndex(m_currentScope->ownProperties().size());
m_currentScope->insertPropertyIdentifier(prop);
if (publicMember->isRequired)

View File

@ -254,11 +254,11 @@ public:
bool isResolved() const;
bool isFullyResolved() const;
QString defaultPropertyName() const { return m_defaultPropertyName; }
void setDefaultPropertyName(const QString &name) { m_defaultPropertyName = name; }
QString ownDefaultPropertyName() const { return m_defaultPropertyName; }
void setOwnDefaultPropertyName(const QString &name) { m_defaultPropertyName = name; }
QString parentPropertyName() const { return m_parentPropertyName; }
void setParentPropertyName(const QString &name) { m_parentPropertyName = name; }
QString ownParentPropertyName() const { return m_parentPropertyName; }
void setOwnParentPropertyName(const QString &name) { m_parentPropertyName = name; }
QString ownAttachedTypeName() const { return m_attachedTypeName; }
void setOwnAttachedTypeName(const QString &name) { m_attachedTypeName = name; }

View File

@ -217,9 +217,9 @@ void QQmlJSTypeDescriptionReader::readComponent(UiObjectDefinition *ast)
} else if (name == QLatin1String("prototype")) {
scope->setBaseTypeName(readStringBinding(script));
} else if (name == QLatin1String("defaultProperty")) {
scope->setDefaultPropertyName(readStringBinding(script));
scope->setOwnDefaultPropertyName(readStringBinding(script));
} else if (name == QLatin1String("parentProperty")) {
scope->setParentPropertyName(readStringBinding(script));
scope->setOwnParentPropertyName(readStringBinding(script));
} else if (name == QLatin1String("exports")) {
readExports(script, scope);
} else if (name == QLatin1String("interfaces")) {

View File

@ -116,7 +116,7 @@ void FindWarningVisitor::endVisit(QQmlJS::AST::UiObjectDefinition *uiod)
QString parentPropertyName;
for (QQmlJSScope::ConstPtr scope = childScope; scope; scope = scope->baseType()) {
parentPropertyName = scope->parentPropertyName();
parentPropertyName = scope->ownParentPropertyName();
if (parentPropertyName.isEmpty())
continue;