diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-05-20 16:37:00 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-05-26 10:00:53 +0200 |
commit | 512fde525ea5972bbae2796d6b2054fd370a5275 (patch) | |
tree | 494bf90df22d96a5ea6465801489e7c17b965e58 | |
parent | 583a99ae6688f526bb4f1877d2f253523903c9ad (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
Pick-to: 5.15
Pick-to: 5.12
Change-Id: I789291e257aeac97c2a931bfc604f453c39906eb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r-- | src/qml/compiler/qv4compiler.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp index 0c0a005689..5665f5fb6b 100644 --- a/src/qml/compiler/qv4compiler.cpp +++ b/src/qml/compiler/qv4compiler.cpp @@ -518,25 +518,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(); } } |