aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/auto/qml/qmlformat/data/verbatimString.formatted.qml3
-rw-r--r--tests/auto/qml/qmlformat/data/verbatimString.qml3
-rw-r--r--tools/qmlformat/dumpastvisitor.cpp6
3 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlformat/data/verbatimString.formatted.qml b/tests/auto/qml/qmlformat/data/verbatimString.formatted.qml
index fa7fbbe32b..84abe38f88 100644
--- a/tests/auto/qml/qmlformat/data/verbatimString.formatted.qml
+++ b/tests/auto/qml/qmlformat/data/verbatimString.formatted.qml
@@ -1,4 +1,7 @@
Item {
property string verbatim1: 'A "verbatim" string!'
property string verbatim2: "A 'verbatim' string\u2757"
+ property string verbatim3: `400 + 300 is ${400 + 300}.
+
+mutliline`
}
diff --git a/tests/auto/qml/qmlformat/data/verbatimString.qml b/tests/auto/qml/qmlformat/data/verbatimString.qml
index 15b080a87b..fa16b97dca 100644
--- a/tests/auto/qml/qmlformat/data/verbatimString.qml
+++ b/tests/auto/qml/qmlformat/data/verbatimString.qml
@@ -1,4 +1,7 @@
Item {
property string verbatim1: 'A "verbatim" string!'
property string verbatim2: "A 'verbatim' string\u2757"
+property string verbatim3: `400 + 300 is ${400 + 300}.
+
+mutliline`
} \ No newline at end of file
diff --git a/tools/qmlformat/dumpastvisitor.cpp b/tools/qmlformat/dumpastvisitor.cpp
index 24d4dd454d..57a1ea9fcb 100644
--- a/tools/qmlformat/dumpastvisitor.cpp
+++ b/tools/qmlformat/dumpastvisitor.cpp
@@ -418,6 +418,12 @@ QString DumpAstVisitor::parseExpression(ExpressionNode *expression)
return "--"+parseExpression(cast<PreDecrementExpression *>(expression)->expression);
case Node::Kind_NumericLiteral:
return QString::number(cast<NumericLiteral *>(expression)->value);
+ case Node::Kind_TemplateLiteral: {
+ auto firstSrcLoc = cast<TemplateLiteral *>(expression)->firstSourceLocation();
+ auto lastSrcLoc = cast<TemplateLiteral *>(expression)->lastSourceLocation();
+ return m_engine->code().mid(static_cast<int>(firstSrcLoc.begin()),
+ static_cast<int>(lastSrcLoc.end() - firstSrcLoc.begin()));
+ }
case Node::Kind_StringLiteral: {
auto srcLoc = cast<StringLiteral *>(expression)->firstSourceLocation();
return m_engine->code().mid(static_cast<int>(srcLoc.begin()),