diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2012-12-04 12:00:23 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2012-12-04 18:56:56 +0100 |
commit | 955f5f03afd9915b7f43ff07ce4b624a86c58a1a (patch) | |
tree | 90eeb1d31ec3b976c38ec615a4dd28bed188f441 /qmljs_environment.cpp | |
parent | 070e0d07d821342bfbe7a409a51c4c53185c62c7 (diff) |
Allow only the ExecutionEngine's StringPool to create Strings.
Strings are the only non-Object Values living on the heap. So by
tracking creation, we can help the future GC a lot.
Change-Id: I5d5044f9ff10da42aeb75dd4a556d6ab3d839b1a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'qmljs_environment.cpp')
-rw-r--r-- | qmljs_environment.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/qmljs_environment.cpp b/qmljs_environment.cpp index ce1bf9da82..94a877586a 100644 --- a/qmljs_environment.cpp +++ b/qmljs_environment.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include <QString> #include "debugging.h" #include <qmljs_environment.h> #include <qmljs_objects.h> @@ -48,27 +49,30 @@ namespace QQmlJS { namespace VM { DiagnosticMessage::DiagnosticMessage() - : fileName(0) - , offset(0) + : offset(0) , length(0) , startLine(0) , startColumn(0) , type(0) - , message(0) , next(0) {} +DiagnosticMessage::~DiagnosticMessage() +{ + delete next; +} + String *DiagnosticMessage::buildFullMessage(ExecutionContext *ctx) const { QString msg; - if (fileName) - msg = fileName->toQString() + QLatin1Char(':'); + if (!fileName.isEmpty()) + msg = fileName + QLatin1Char(':'); msg += QString::number(startLine) + QLatin1Char(':') + QString::number(startColumn) + QLatin1String(": "); if (type == QQmlJS::VM::DiagnosticMessage::Error) msg += QLatin1String("error"); else msg += QLatin1String("warning"); - msg += ": " + message->toQString(); + msg += ": " + message; return ctx->engine->newString(msg); } |