aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-05-20 16:37:00 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-06-02 08:15:24 +0000
commit9bd647885138cf15b4578f3f7311110bf6f36282 (patch)
tree749158f97c8bea4a001060988c704ab73f34f38e
parent208c98b7e97690179cb16b132a4bf26baa79e0d7 (diff)
Prettify QV4_SHOW_BYTECODE output for JS classes
Drop all the double spaces, force a line break after each class, and avoid converting empty strings to utf8. Coverity-Id: 190711 Change-Id: I789291e257aeac97c2a931bfc604f453c39906eb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 512fde525ea5972bbae2796d6b2054fd370a5275) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/qml/compiler/qv4compiler.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp
index 4d85f25d4b..9c4f99d93a 100644
--- a/src/qml/compiler/qv4compiler.cpp
+++ b/src/qml/compiler/qv4compiler.cpp
@@ -480,25 +480,26 @@ void QV4::Compiler::JSUnitGenerator::writeClass(char *b, const QV4::Compiler::Cl
static const bool showCode = qEnvironmentVariableIsSet("QV4_SHOW_BYTECODE");
if (showCode) {
- qDebug() << "=== Class " << stringForIndex(cls->nameIndex) << "static methods" << cls->nStaticMethods << "methods" << cls->nMethods;
+ qDebug() << "=== Class" << stringForIndex(cls->nameIndex) << "static methods"
+ << cls->nStaticMethods << "methods" << cls->nMethods;
qDebug() << " constructor:" << cls->constructorFunction;
- const char *staticString = ": static ";
for (uint i = 0; i < cls->nStaticMethods + cls->nMethods; ++i) {
- if (i == cls->nStaticMethods)
- staticString = ": ";
- const char *type;
+ QDebug output = qDebug().nospace();
+ output << " " << i << ": ";
+ if (i < cls->nStaticMethods)
+ output << "static ";
switch (cls->methodTable()[i].type) {
case CompiledData::Method::Getter:
- type = "get "; break;
+ output << "get "; break;
case CompiledData::Method::Setter:
- type = "set "; break;
+ output << "set "; break;
default:
- type = "";
-
+ break;
}
- qDebug() << " " << i << staticString << type << stringForIndex(cls->methodTable()[i].name) << cls->methodTable()[i].function;
+ output << stringForIndex(cls->methodTable()[i].name) << " "
+ << cls->methodTable()[i].function;
}
- qDebug();
+ qDebug().space();
}
}