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