diff options
Diffstat (limited to 'src/qmlcompiler/qqmljsannotation.cpp')
-rw-r--r-- | src/qmlcompiler/qqmljsannotation.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/qmlcompiler/qqmljsannotation.cpp b/src/qmlcompiler/qqmljsannotation.cpp new file mode 100644 index 0000000000..2d5814f0a7 --- /dev/null +++ b/src/qmlcompiler/qqmljsannotation.cpp @@ -0,0 +1,25 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#include "qqmljsannotation_p.h" + +QT_BEGIN_NAMESPACE + +bool QQmlJSAnnotation::isDeprecation() const { return name == QStringLiteral("Deprecated"); } + +QQQmlJSDeprecation QQmlJSAnnotation::deprecation() const { + Q_ASSERT(isDeprecation()); + QQQmlJSDeprecation deprecation; + if (bindings.contains(QStringLiteral("reason"))) { + + auto reason = bindings[QStringLiteral("reason")]; + + if (std::holds_alternative<QString>(reason)) { + deprecation.reason = std::get<QString>(reason); + } + } + + return deprecation; +} + +QT_END_NAMESPACE |