aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmldom/qqmldomreformatter.cpp
diff options
context:
space:
mode:
authorSami Shalayel <sami.shalayel@qt.io>2023-09-06 17:07:21 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-09-11 23:36:12 +0000
commit03bd497190c331e27587beb2f324bf8673361aa8 (patch)
tree70b3fec60840040300d48a5f9da06911c99e8be6 /src/qmldom/qqmldomreformatter.cpp
parent9c1696bf514a1d31568aabbabf40db5434f8cf97 (diff)
FormalParameterList: prepare for qmlformat
Remove useless arg#0 bindingIdentifier from FormalParameterList. They are used nowhere, are not tested and are not even set correctly: FormalParameterList::finish() sets next to nullptr before its forloop that goes from this to this->next (that was freshly set to nullptr three lines above)... Instead of setting bindingIdentifier to arg#0 when its empty and testing for arg#, just test for bindingIdentifier being empty. That saves some trouble in qmlformat because you dont have to care about the position that the current method parameter has. Apropos position of the current parameter: qmlformat needs some context when doing its reformatting test, to avoid reparsing code in completely wrong contexts. Add missing preCode and postCode to MethodParameter to provide an artificial context for qmlformat, so it knows that it is working on a MethodParameter, and also teach qmlformat how to get the FormalParameter out of the artificial context, by extracting it from the FormalParameterList. Pick-to: 6.5 Change-Id: I2bc82f65d95c3cd09ad846c60dd7561ac03efad3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Semih Yavuz <semih.yavuz@qt.io> (cherry picked from commit 640ff3d8125264e25bd1826529b9a57cdddf2205) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/qmldom/qqmldomreformatter.cpp')
-rw-r--r--src/qmldom/qqmldomreformatter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qmldom/qqmldomreformatter.cpp b/src/qmldom/qqmldomreformatter.cpp
index fcc847591d..a925fe3bbe 100644
--- a/src/qmldom/qqmldomreformatter.cpp
+++ b/src/qmldom/qqmldomreformatter.cpp
@@ -983,7 +983,7 @@ protected:
{
for (FormalParameterList *it = ast; it; it = it->next) {
// compare FormalParameterList::finish
- if (auto id = it->element->bindingIdentifier.toString(); !id.startsWith(u"arg#"))
+ if (auto id = it->element->bindingIdentifier.toString(); !id.isEmpty())
out(id);
if (it->element->bindingTarget)
accept(it->element->bindingTarget);