mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 16:53:32 +02:00
Update ScriptEngine.cpp
Just some revisions...
This commit is contained in:
parent
4096d75bb4
commit
ab46b1fc9e
1 changed files with 6 additions and 6 deletions
|
@ -120,7 +120,7 @@ static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine) {
|
|||
|
||||
// was this generated by a script engine? If we don't recognize it then send the message and exit
|
||||
ScriptEngine* scriptEngine = qobject_cast<ScriptEngine*>(engine);
|
||||
if (scriptEngine == nullptr) {
|
||||
if (!scriptEngine) {
|
||||
qCDebug(scriptengine_script, "%s", qUtf8Printable(message));
|
||||
return QScriptValue();
|
||||
}
|
||||
|
@ -130,20 +130,17 @@ static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine) {
|
|||
AbstractLoggerInterface* loggerInterface = AbstractLoggerInterface::get();
|
||||
if (loggerInterface->showSourceDebugging()) {
|
||||
QScriptContext* userContext = context;
|
||||
while (userContext != nullptr && QScriptContextInfo(userContext).functionType() == QScriptContextInfo::NativeFunction) {
|
||||
while (userContext && QScriptContextInfo(userContext).functionType() == QScriptContextInfo::NativeFunction) {
|
||||
userContext = userContext->parentContext();
|
||||
}
|
||||
QString location;
|
||||
if (userContext != nullptr) {
|
||||
if (userContext) {
|
||||
QScriptContextInfo contextInfo(userContext);
|
||||
QString fileName = contextInfo.fileName();
|
||||
int lineNumber = contextInfo.lineNumber();
|
||||
QString functionName = contextInfo.functionName();
|
||||
|
||||
location = functionName;
|
||||
if (lineNumber != -1) {
|
||||
location = QString("%1:%2").arg(location).arg(lineNumber);
|
||||
}
|
||||
if (!fileName.isEmpty()) {
|
||||
if (location.isEmpty()) {
|
||||
location = fileName;
|
||||
|
@ -151,6 +148,9 @@ static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine) {
|
|||
location = QString("%1 at %2").arg(location).arg(fileName);
|
||||
}
|
||||
}
|
||||
if (lineNumber != -1) {
|
||||
location = QString("%1:%2").arg(location).arg(lineNumber);
|
||||
}
|
||||
}
|
||||
if (location.isEmpty()) {
|
||||
location = scriptEngine->getFilename();
|
||||
|
|
Loading…
Reference in a new issue