| 1 | // Copyright (C) 2021 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
| 3 | |
| 4 | #include "qqmljsannotation_p.h" |
| 5 | |
| 6 | QT_BEGIN_NAMESPACE |
| 7 | |
| 8 | bool QQmlJSAnnotation::isDeprecation() const { return name == QStringLiteral("Deprecated"); } |
| 9 | |
| 10 | QQQmlJSDeprecation QQmlJSAnnotation::deprecation() const { |
| 11 | Q_ASSERT(isDeprecation()); |
| 12 | QQQmlJSDeprecation deprecation; |
| 13 | if (bindings.contains(QStringLiteral("reason"))) { |
| 14 | |
| 15 | auto reason = bindings[QStringLiteral("reason")]; |
| 16 | |
| 17 | if (std::holds_alternative<QString>(v: reason)) { |
| 18 | deprecation.reason = std::get<QString>(v&: reason); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | return deprecation; |
| 23 | } |
| 24 | |
| 25 | QT_END_NAMESPACE |
| 26 |
