Just some revisions...
Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all
Unified · Split
| @@ -120,7 +120,7 @@ static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine) { · 119 unmodified lines | ||
| 120 | 120 | |
| 121 | 121 | // was this generated by a script engine? If we don't recognize it then send the message and exit |
| 122 | 122 | ScriptEngine* scriptEngine = qobject_cast<ScriptEngine*>(engine); |
| 123 | − if (scriptEngine == nullptr) { | |
| 123 | + if (!scriptEngine) { | |
| 124 | 124 | qCDebug(scriptengine_script, "%s", qUtf8Printable(message)); |
| 125 | 125 | return QScriptValue(); |
| 126 | 126 | } |
| @@ -130,20 +130,17 @@ static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine) { · 3 unmodified lines | ||
| 130 | 130 | AbstractLoggerInterface* loggerInterface = AbstractLoggerInterface::get(); |
| 131 | 131 | if (loggerInterface->showSourceDebugging()) { |
| 132 | 132 | QScriptContext* userContext = context; |
| 133 | − while (userContext != nullptr && QScriptContextInfo(userContext).functionType() == QScriptContextInfo::NativeFunction) { | |
| 133 | + while (userContext && QScriptContextInfo(userContext).functionType() == QScriptContextInfo::NativeFunction) { | |
| 134 | 134 | userContext = userContext->parentContext(); |
| 135 | 135 | } |
| 136 | 136 | QString location; |
| 137 | − if (userContext != nullptr) { | |
| 137 | + if (userContext) { | |
| 138 | 138 | QScriptContextInfo contextInfo(userContext); |
| 139 | 139 | QString fileName = contextInfo.fileName(); |
| 140 | 140 | int lineNumber = contextInfo.lineNumber(); |
| 141 | 141 | QString functionName = contextInfo.functionName(); |
| 142 | 142 | |
| 143 | 143 | location = functionName; |
| 144 | − if (lineNumber != -1) { | |
| 145 | − location = QString("%1:%2").arg(location).arg(lineNumber); | |
| 146 | − } | |
| 147 | 144 | if (!fileName.isEmpty()) { |
| 148 | 145 | if (location.isEmpty()) { |
| 149 | 146 | location = fileName; |
| @@ -151,6 +148,9 @@ static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine) { · 1 unmodified line | ||
| 151 | 148 | location = QString("%1 at %2").arg(location).arg(fileName); |
| 152 | 149 | } |
| 153 | 150 | } |
| 151 | + if (lineNumber != -1) { | |
| 152 | + location = QString("%1:%2").arg(location).arg(lineNumber); | |
| 153 | + } | |
| 154 | 154 | } |
| 155 | 155 | if (location.isEmpty()) { |
| 156 | 156 | location = scriptEngine->getFilename(); |