diff options
author | Semih Yavuz <semih.yavuz@qt.io> | 2024-03-24 21:41:52 +0100 |
---|---|---|
committer | Semih Yavuz <semih.yavuz@qt.io> | 2024-04-11 00:06:30 +0200 |
commit | 034eb34219bdfcffe2676e3d41bd48797cad8a2c (patch) | |
tree | e41b400dc9befedb4e974b9e73d47939713b883d /src/qmldom/qqmldomcomments_p.h | |
parent | 7a2bc1e2b064593df97ad1cf8346d60008861f77 (diff) |
Add source location info to Comment
We need to know source location of comments for semantic highlighting.
Task-number: QTBUG-120000
Change-Id: I37cccf06c441a3da51aacde19eead57ccaae53d0
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'src/qmldom/qqmldomcomments_p.h')
-rw-r--r-- | src/qmldom/qqmldomcomments_p.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/qmldom/qqmldomcomments_p.h b/src/qmldom/qqmldomcomments_p.h index 20eaee3fd2..732a74162a 100644 --- a/src/qmldom/qqmldomcomments_p.h +++ b/src/qmldom/qqmldomcomments_p.h @@ -75,12 +75,14 @@ public: enum CommentType {Pre, Post}; - Comment(const QString &c, int newlinesBefore = 1, CommentType type = Pre) - : m_comment(c), m_newlinesBefore(newlinesBefore), m_type(type) + Comment(const QString &c, const QQmlJS::SourceLocation &loc, int newlinesBefore = 1, + CommentType type = Pre) + : m_comment(c), m_location(loc), m_newlinesBefore(newlinesBefore), m_type(type) { } - Comment(QStringView c, int newlinesBefore = 1, CommentType type = Pre) - : m_comment(c), m_newlinesBefore(newlinesBefore), m_type(type) + Comment(QStringView c, const QQmlJS::SourceLocation &loc, int newlinesBefore = 1, + CommentType type = Pre) + : m_comment(c), m_location(loc), m_newlinesBefore(newlinesBefore), m_type(type) { } @@ -99,8 +101,11 @@ public: } friend bool operator!=(const Comment &c1, const Comment &c2) { return !(c1 == c2); } + QQmlJS::SourceLocation sourceLocation() const { return m_location; }; + private: QStringView m_comment; + QQmlJS::SourceLocation m_location; int m_newlinesBefore; CommentType m_type; }; |