QmlCompiler: Add hasMethod() and hasProperty() to QQmlJSScope

Change-Id: I29e38054a5adcf398f63df7f367ed4bc24c09c75
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Ulf Hermann 2020-10-18 11:48:11 +02:00
parent c1c01e21d1
commit cc57bac899
1 changed files with 2 additions and 0 deletions

View File

@ -167,6 +167,7 @@ public:
void addMethod(const QQmlJSMetaMethod &method) { m_methods.insert(method.methodName(), method); }
QMultiHash<QString, QQmlJSMetaMethod> methods() const { return m_methods; }
QQmlJSMetaMethod method(const QString &name) const { return m_methods.value(name); }
bool hasMethod(const QString &name) const { return m_methods.contains(name); }
void addEnum(const QQmlJSMetaEnum &fakeEnum) { m_enums.insert(fakeEnum.name(), fakeEnum); }
QHash<QString, QQmlJSMetaEnum> enums() const { return m_enums; }
@ -192,6 +193,7 @@ public:
void addProperty(const QQmlJSMetaProperty &prop) { m_properties.insert(prop.propertyName(), prop); }
QHash<QString, QQmlJSMetaProperty> properties() const { return m_properties; }
QQmlJSMetaProperty property(const QString &name) const { return m_properties.value(name); }
bool hasProperty(const QString &name) const { return m_properties.contains(name); }
QString defaultPropertyName() const { return m_defaultPropertyName; }
void setDefaultPropertyName(const QString &name) { m_defaultPropertyName = name; }