aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser/qqmljsast.cpp
diff options
context:
space:
mode:
authorFawzi Mohamed <fawzi.mohamed@qt.io>2020-02-06 14:15:09 +0100
committerFawzi Mohamed <fawzi.mohamed@qt.io>2020-02-12 10:17:18 +0100
commit87f5cc385b670a63c2f2ba0ef90cba95ab215200 (patch)
treea20ba1d0c3644a422d196895eeeff0bd0d927830 /src/qml/parser/qqmljsast.cpp
parent8e822e981d91e688799c8670f11dfdf6aaf9e0d1 (diff)
Add annotations to AST
Annotations are added to UiObjectMember. This makes it easy to find the annotations of any UiObjectMember through the annotations attribute. The clean AST approach would add an UiAnnotatedObjectMember that contains both the annotation list and an UiObjectMember, but that makes finding the annotation more difficult. The annotations are not visited by default, if one wants to dump them before the current object the simplest way is to use the preVisit and use .uiObjectMemberCast(). Depending on how we use annotation we could change the current approach. Task-number: QTBUG-81714 Change-Id: I543a2cfe5157bcc86de6de9faebde9aea22974eb Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/parser/qqmljsast.cpp')
-rw-r--r--src/qml/parser/qqmljsast.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/qml/parser/qqmljsast.cpp b/src/qml/parser/qqmljsast.cpp
index 416916c547..19b03d3cd1 100644
--- a/src/qml/parser/qqmljsast.cpp
+++ b/src/qml/parser/qqmljsast.cpp
@@ -1562,6 +1562,15 @@ void UiRequired::accept0(Visitor *visitor)
visitor->endVisit(this);
}
+void UiAnnotationList::accept0(Visitor *visitor)
+{
+ if (visitor->visit(this)) {
+ accept(annotation, visitor);
+ }
+
+ visitor->endVisit(this);
+}
+
} } // namespace QQmlJS::AST
QT_END_NAMESPACE