diff options
-rw-r--r-- | src/script/api/qscriptcontextinfo.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qscriptcontext/tst_qscriptcontext.cpp | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/script/api/qscriptcontextinfo.cpp b/src/script/api/qscriptcontextinfo.cpp index a305116..04c26e2 100644 --- a/src/script/api/qscriptcontextinfo.cpp +++ b/src/script/api/qscriptcontextinfo.cpp @@ -172,7 +172,7 @@ QScriptContextInfoPrivate::QScriptContextInfoPrivate(const QScriptContext *conte JSC::CodeBlock *codeBlock = frame->codeBlock(); if (returnPC && codeBlock) { lineNumber = codeBlock->lineNumberForBytecodeOffset(const_cast<JSC::ExecState *>(frame), - returnPC - codeBlock->instructions().begin()); + returnPC - codeBlock->instructions().begin() -1); } } } diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp index c09ebdb..e5d26a3 100644 --- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp +++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp @@ -574,7 +574,8 @@ void tst_QScriptContext::backtrace_data() "function foo() {\n" " return bt(123);\n" "}\n" - "foo('hello', { })" ); + "foo('hello', { })\n" + "var r = 0;"); QTest::newRow("simple") << source << expected; } @@ -585,12 +586,14 @@ void tst_QScriptContext::backtrace_data() "function foo(arg1 , arg2) {\n" " return eval(\"%1\");\n" "}\n" - "foo('hello', 456)" + "foo('hello', 456)\n" + "var a = 0;" ).arg("\\n \\n bt('hey'); \\n"); expected << "<native>('hey') at -1" << "<eval>() at 3" - << "foo(arg1 = 'hello', arg2 = 456) at testfile:-1" //### line number should be 2 + //### line number should be 2 but the line number information is not kept for eval call + << "foo(arg1 = 'hello', arg2 = 456) at testfile:-1" << "<global>() at testfile:4"; QTest::newRow("eval") << source << expected; |