diff options
Diffstat (limited to 'tools/qmlformat')
-rw-r--r-- | tools/qmlformat/commentastvisitor.h | 1 | ||||
-rw-r--r-- | tools/qmlformat/dumpastvisitor.cpp | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/tools/qmlformat/commentastvisitor.h b/tools/qmlformat/commentastvisitor.h index 6ebf8246ba..09bc786985 100644 --- a/tools/qmlformat/commentastvisitor.h +++ b/tools/qmlformat/commentastvisitor.h @@ -65,6 +65,7 @@ struct Comment QList<SourceLocation> m_srcLocations; + bool hasSheBang() const { return !m_srcLocations.isEmpty() && m_srcLocations.first().begin() == 0; } bool isValid() const { return !m_srcLocations.isEmpty(); } bool isMultiline() const { return m_text.contains("\n"); } bool isSyntheticMultiline() const { return m_srcLocations.size() > 1; } diff --git a/tools/qmlformat/dumpastvisitor.cpp b/tools/qmlformat/dumpastvisitor.cpp index 771814ffd5..723be4e445 100644 --- a/tools/qmlformat/dumpastvisitor.cpp +++ b/tools/qmlformat/dumpastvisitor.cpp @@ -129,7 +129,7 @@ QString DumpAstVisitor::formatComment(const Comment &comment) const if (useMultilineComment) result += "/*"; - else + else if (!comment.hasSheBang()) result += "//"; result += comment.m_text; |