diff options
Diffstat (limited to 'src/qmlcompiler/qqmljsmetatypes.cpp')
-rw-r--r-- | src/qmlcompiler/qqmljsmetatypes.cpp | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/src/qmlcompiler/qqmljsmetatypes.cpp b/src/qmlcompiler/qqmljsmetatypes.cpp index 9ba7d2ca54..4155e58728 100644 --- a/src/qmlcompiler/qqmljsmetatypes.cpp +++ b/src/qmlcompiler/qqmljsmetatypes.cpp @@ -13,21 +13,9 @@ QT_BEGIN_NAMESPACE A binding is valid when it has both a target (m_propertyName is set) and some content set (m_bindingType != Invalid). */ -bool QQmlJSMetaPropertyBinding::isValid() const { return !m_propertyName.isEmpty() && bindingType() != Invalid; } - -QString QQmlJSMetaPropertyBinding::literalTypeName() const +bool QQmlJSMetaPropertyBinding::isValid() const { - if (std::holds_alternative<Content::BoolLiteral>(m_bindingContent)) - return QLatin1String("bool"); - else if (std::holds_alternative<Content::NumberLiteral>(m_bindingContent)) - return QLatin1String("double"); - else if (std::holds_alternative<Content::StringLiteral>(m_bindingContent)) - return QLatin1String("string"); - else if (std::holds_alternative<Content::RegexpLiteral>(m_bindingContent)) - return QLatin1String("regexp"); - else if (std::holds_alternative<Content::Null>(m_bindingContent)) - return QLatin1String("$internal$.std::nullptr_t"); - return {}; + return !m_propertyName.isEmpty() && bindingType() != QQmlSA::BindingType::Invalid; } bool QQmlJSMetaPropertyBinding::boolValue() const @@ -93,28 +81,30 @@ QSharedPointer<const QQmlJSScope> QQmlJSMetaPropertyBinding::literalType(const Q { Q_ASSERT(resolver); switch (bindingType()) { - case QQmlJSMetaPropertyBinding::BoolLiteral: + case BindingType::BoolLiteral: return resolver->boolType(); - case QQmlJSMetaPropertyBinding::NumberLiteral: + case BindingType::NumberLiteral: return resolver->typeForName(QLatin1String("double")); - case QQmlJSMetaPropertyBinding::Translation: // translations are strings - case QQmlJSMetaPropertyBinding::TranslationById: - case QQmlJSMetaPropertyBinding::StringLiteral: + case BindingType::Translation: // translations are strings + case BindingType::TranslationById: + case BindingType::StringLiteral: return resolver->stringType(); - case QQmlJSMetaPropertyBinding::RegExpLiteral: + case BindingType::RegExpLiteral: return resolver->typeForName(QLatin1String("regexp")); - case QQmlJSMetaPropertyBinding::Null: + case BindingType::Null: return resolver->nullType(); - case QQmlJSMetaPropertyBinding::Invalid: - case QQmlJSMetaPropertyBinding::Script: - case QQmlJSMetaPropertyBinding::Object: - case QQmlJSMetaPropertyBinding::Interceptor: - case QQmlJSMetaPropertyBinding::ValueSource: - case QQmlJSMetaPropertyBinding::AttachedProperty: - case QQmlJSMetaPropertyBinding::GroupProperty: + case BindingType::Invalid: + case BindingType::Script: + case BindingType::Object: + case BindingType::Interceptor: + case BindingType::ValueSource: + case BindingType::AttachedProperty: + case BindingType::GroupProperty: return {}; } Q_UNREACHABLE_RETURN({}); } +QQmlJSMetaPropertyBinding::QQmlJSMetaPropertyBinding() = default; + QT_END_NAMESPACE |