diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-08-10 10:12:33 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-08-10 10:12:33 (GMT) |
commit | 34511e1001471ed4041794640aefe508f50ad01c (patch) | |
tree | 1064dd607bcf221bc65575b7588e8f52ab41934c /src/script/api/qscriptcontext.cpp | |
parent | 94cf9e210e155be9cb93ac321b2f68725b47e58d (diff) | |
download | Qt-34511e1001471ed4041794640aefe508f50ad01c.zip Qt-34511e1001471ed4041794640aefe508f50ad01c.tar.gz Qt-34511e1001471ed4041794640aefe508f50ad01c.tar.bz2 |
implement QScriptContext::backtrace()
Doesn't pass the test yet, but at least it returns something that
might be useful on occasion.
Diffstat (limited to 'src/script/api/qscriptcontext.cpp')
-rw-r--r-- | src/script/api/qscriptcontext.cpp | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/src/script/api/qscriptcontext.cpp b/src/script/api/qscriptcontext.cpp index bce7687..66d4c3e 100644 --- a/src/script/api/qscriptcontext.cpp +++ b/src/script/api/qscriptcontext.cpp @@ -548,43 +548,11 @@ QScriptContext::ExecutionState QScriptContext::state() const QStringList QScriptContext::backtrace() const { QStringList result; - qWarning("QScriptContext::backtrace() not implemented"); -#if 0 - const QScriptContextPrivate *ctx = this; + const QScriptContext *ctx = this; while (ctx) { - QString s; - QString functionName = ctx->functionName(); - if (!functionName.isEmpty()) - s += functionName; - else { - if (ctx->parentContext()) { - if (ctx->callee().isFunction() - && ctx->callee().toFunction()->type() != QScriptFunction::Script) { - s += QLatin1String("<native>"); - } else { - s += QLatin1String("<anonymous>"); - } - } else { - s += QLatin1String("<global>"); - } - } - s += QLatin1Char('('); - for (int i = 0; i < ctx->argc; ++i) { - if (i > 0) - s += QLatin1Char(','); - QScriptValueImpl arg = ctx->args[i]; - if (arg.isObject()) - s += QLatin1String("[object Object]"); // don't do a function call - else - s += arg.toString(); - } - s += QLatin1String(")@"); - s += ctx->fileName(); - s += QString::fromLatin1(":%0").arg(ctx->currentLine); - result.append(s); + result.append(ctx->toString()); ctx = ctx->parentContext(); } -#endif return result; } |