aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/modifications.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-01-12 09:12:16 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2022-01-12 11:47:17 +0100
commitf01e3e2bcc78222144c0279a8bfac274f8054d2f (patch)
tree3052432bfb55894762f6fc9ea882153b0b4ec213 /sources/shiboken6/ApiExtractor/modifications.cpp
parent258bb0c2b49ead03725b6fa2ed700bd3e468a008 (diff)
shiboken6: Fix debug operators for code snips
Declare the operator and output conversion rules of argument modifications. Output code snip fragments and template names. Pick-to: 6.2 Task-number: PYSIDE-1766 Change-Id: I56de33a2a56eee2fa357c5dda89cc391c99b76f9 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken6/ApiExtractor/modifications.cpp')
-rw-r--r--sources/shiboken6/ApiExtractor/modifications.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/sources/shiboken6/ApiExtractor/modifications.cpp b/sources/shiboken6/ApiExtractor/modifications.cpp
index 92b445791..7fa73675e 100644
--- a/sources/shiboken6/ApiExtractor/modifications.cpp
+++ b/sources/shiboken6/ApiExtractor/modifications.cpp
@@ -428,17 +428,29 @@ QDebug operator<<(QDebug d, const CodeSnip &s)
QDebugStateSaver saver(d);
d.noquote();
d.nospace();
- d << "CodeSnip(language=" << s.language << ", position=" << s.position << ", \"";
- for (const auto &f : s.codeList) {
- const QString &code = f.code();
- const auto lines = QStringView{code}.split(QLatin1Char('\n'));
- for (int i = 0, size = lines.size(); i < size; ++i) {
- if (i)
- d << "\\n";
- d << lines.at(i).trimmed();
+ const auto size = s.codeList.size();
+ d << "CodeSnip(language=" << s.language << ", position=" << s.position
+ << ", fragments[" << size << "]=";
+ for (qsizetype i = 0; i < size; ++i) {
+ const auto &f = s.codeList.at(i);
+ if (i)
+ d << ", ";
+ d << '#' << i << ' ';
+ if (f.instance().isNull()) {
+ d << '"';
+ const QString &code = f.code();
+ const auto lines = QStringView{code}.split(QLatin1Char('\n'));
+ for (int i = 0, size = lines.size(); i < size; ++i) {
+ if (i)
+ d << "\\n";
+ d << lines.at(i).trimmed();
+ }
+ d << '"';
+ } else {
+ d << "template=\"" << f.instance()->name() << '"';
}
}
- d << "\")";
+ d << ')';
return d;
}
@@ -911,6 +923,9 @@ QDebug operator<<(QDebug d, const ArgumentModification &a)
d << ", native ownership=" << a.nativeOwnership();
if (!a.renamedToName().isEmpty())
d << ", renamed_to=\"" << a.renamedToName() << '"';
+ const auto &rules = a.conversionRules();
+ if (!rules.isEmpty())
+ d << ", conversionRules[" << rules.size() << "]=" << rules;
d << ", owner=" << a.owner() << ')';
return d;
}