Showing the changes to libraries/script-engine/src/ConsoleScriptingInterface.cpp (1 of 370 files). Show all
Unified · Split
| @@ -34,7 +34,7 @@ QList<QString> ConsoleScriptingInterface::_groupDetails = QList<QString>(); · 33 unmodified lines | ||
| 34 | 34 | |
| 35 | 35 | ScriptValue ConsoleScriptingInterface::info(ScriptContext* context, ScriptEngine* engine) { |
| 36 | 36 | if (ScriptManager* scriptManager = engine->manager()) { |
| 37 | − scriptManager->scriptInfoMessage(appendArguments(context)); | |
| 37 | + scriptManager->scriptInfoMessage(appendArguments(context), context->currentFileName(), context->currentLineNumber()); | |
| 38 | 38 | } |
| 39 | 39 | return engine->nullValue(); |
| 40 | 40 | } |
| @@ -43,7 +43,7 @@ ScriptValue ConsoleScriptingInterface::log(ScriptContext* context, ScriptEngine* · 2 unmodified lines | ||
| 43 | 43 | QString message = appendArguments(context); |
| 44 | 44 | if (_groupDetails.count() == 0) { |
| 45 | 45 | if (ScriptManager* scriptManager = engine->manager()) { |
| 46 | − scriptManager->scriptPrintedMessage(message); | |
| 46 | + scriptManager->scriptPrintedMessage(message, context->currentFileName(), context->currentLineNumber()); | |
| 47 | 47 | } |
| 48 | 48 | } else { |
| 49 | 49 | logGroupMessage(message, engine); |
| @@ -53,28 +53,28 @@ ScriptValue ConsoleScriptingInterface::log(ScriptContext* context, ScriptEngine* · 3 unmodified lines | ||
| 53 | 53 | |
| 54 | 54 | ScriptValue ConsoleScriptingInterface::debug(ScriptContext* context, ScriptEngine* engine) { |
| 55 | 55 | if (ScriptManager* scriptManager = engine->manager()) { |
| 56 | − scriptManager->scriptPrintedMessage(appendArguments(context)); | |
| 56 | + scriptManager->scriptPrintedMessage(appendArguments(context), context->currentFileName(), context->currentLineNumber()); | |
| 57 | 57 | } |
| 58 | 58 | return engine->nullValue(); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | ScriptValue ConsoleScriptingInterface::warn(ScriptContext* context, ScriptEngine* engine) { |
| 62 | 62 | if (ScriptManager* scriptManager = engine->manager()) { |
| 63 | − scriptManager->scriptWarningMessage(appendArguments(context)); | |
| 63 | + scriptManager->scriptWarningMessage(appendArguments(context), context->currentFileName(), context->currentLineNumber()); | |
| 64 | 64 | } |
| 65 | 65 | return engine->nullValue(); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | ScriptValue ConsoleScriptingInterface::error(ScriptContext* context, ScriptEngine* engine) { |
| 69 | 69 | if (ScriptManager* scriptManager = engine->manager()) { |
| 70 | − scriptManager->scriptErrorMessage(appendArguments(context)); | |
| 70 | + scriptManager->scriptErrorMessage(appendArguments(context), context->currentFileName(), context->currentLineNumber()); | |
| 71 | 71 | } |
| 72 | 72 | return engine->nullValue(); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | ScriptValue ConsoleScriptingInterface::exception(ScriptContext* context, ScriptEngine* engine) { |
| 76 | 76 | if (ScriptManager* scriptManager = engine->manager()) { |
| 77 | − scriptManager->scriptErrorMessage(appendArguments(context)); | |
| 77 | + scriptManager->scriptErrorMessage(appendArguments(context), context->currentFileName(), context->currentLineNumber()); | |
| 78 | 78 | } |
| 79 | 79 | return engine->nullValue(); |
| 80 | 80 | } |
| @@ -82,23 +82,23 @@ ScriptValue ConsoleScriptingInterface::exception(ScriptContext* context, ScriptE · 1 unmodified line | ||
| 82 | 82 | void ConsoleScriptingInterface::time(QString labelName) { |
| 83 | 83 | _timerDetails.insert(labelName, QDateTime::currentDateTime().toUTC()); |
| 84 | 84 | QString message = QString("%1: Timer started").arg(labelName); |
| 85 | − Q_ASSERT(engine); | |
| 85 | + Q_ASSERT(engine()); | |
| 86 | 86 | if (ScriptManager* scriptManager = engine()->manager()) { |
| 87 | − scriptManager->scriptPrintedMessage(message); | |
| 87 | + scriptManager->scriptPrintedMessage(message, context()->currentFileName(), context()->currentLineNumber()); | |
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | void ConsoleScriptingInterface::timeEnd(QString labelName) { |
| 92 | − Q_ASSERT(engine); | |
| 92 | + Q_ASSERT(engine()); | |
| 93 | 93 | if (ScriptManager* scriptManager = engine()->manager()) { |
| 94 | 94 | if (!_timerDetails.contains(labelName)) { |
| 95 | − scriptManager->scriptErrorMessage("No such label found " + labelName); | |
| 95 | + scriptManager->scriptErrorMessage("No such label found " + labelName, context()->currentFileName(), context()->currentLineNumber()); | |
| 96 | 96 | return; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | if (_timerDetails.value(labelName).isNull()) { |
| 100 | 100 | _timerDetails.remove(labelName); |
| 101 | − scriptManager->scriptErrorMessage("Invalid start time for " + labelName); | |
| 101 | + scriptManager->scriptErrorMessage("Invalid start time for " + labelName, context()->currentFileName(), context()->currentLineNumber()); | |
| 102 | 102 | return; |
| 103 | 103 | } |
| 104 | 104 | QDateTime _startTime = _timerDetails.value(labelName); |
| @@ -108,7 +108,7 @@ void ConsoleScriptingInterface::timeEnd(QString labelName) { · 3 unmodified lines | ||
| 108 | 108 | QString message = QString("%1: %2ms").arg(labelName).arg(QString::number(diffInMS)); |
| 109 | 109 | _timerDetails.remove(labelName); |
| 110 | 110 | |
| 111 | − scriptManager->scriptPrintedMessage(message); | |
| 111 | + scriptManager->scriptPrintedMessage(message, context()->currentFileName(), context()->currentLineNumber()); | |
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
| @@ -131,24 +131,24 @@ ScriptValue ConsoleScriptingInterface::assertion(ScriptContext* context, ScriptE · 16 unmodified lines | ||
| 131 | 131 | assertionResult = QString("Assertion failed : %1").arg(message); |
| 132 | 132 | } |
| 133 | 133 | if (ScriptManager* scriptManager = engine->manager()) { |
| 134 | − scriptManager->scriptErrorMessage(assertionResult); | |
| 134 | + scriptManager->scriptErrorMessage(assertionResult, context->currentFileName(), context->currentLineNumber()); | |
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | return engine->nullValue(); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | void ConsoleScriptingInterface::trace() { |
| 141 | − Q_ASSERT(engine); | |
| 141 | + Q_ASSERT(engine()); | |
| 142 | 142 | ScriptEnginePointer scriptEngine = engine(); |
| 143 | 143 | if (ScriptManager* scriptManager = scriptEngine->manager()) { |
| 144 | 144 | scriptManager->scriptPrintedMessage |
| 145 | 145 | (QString(STACK_TRACE_FORMAT).arg(LINE_SEPARATOR, |
| 146 | − scriptEngine->currentContext()->backtrace().join(LINE_SEPARATOR))); | |
| 146 | + scriptEngine->currentContext()->backtrace().join(LINE_SEPARATOR)), context()->currentFileName(), context()->currentLineNumber()); | |
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | void ConsoleScriptingInterface::clear() { |
| 151 | − Q_ASSERT(engine); | |
| 151 | + Q_ASSERT(engine()); | |
| 152 | 152 | if (ScriptManager* scriptManager = engine()->manager()) { |
| 153 | 153 | scriptManager->clearDebugLogWindow(); |
| 154 | 154 | } |
| @@ -190,6 +190,6 @@ void ConsoleScriptingInterface::logGroupMessage(QString message, ScriptEngine* e · 35 unmodified lines | ||
| 190 | 190 | } |
| 191 | 191 | logMessage.append(message); |
| 192 | 192 | if (ScriptManager* scriptManager = engine->manager()) { |
| 193 | − scriptManager->scriptPrintedMessage(logMessage); | |
| 193 | + scriptManager->scriptPrintedMessage(logMessage, context()->currentFileName(), context()->currentLineNumber()); | |
| 194 | 194 | } |
| 195 | 195 | } |