diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-08-17 12:08:21 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2013-08-18 12:28:24 +0200 |
commit | 45dacdaa788eeac64148465658b6af2d2fa552cf (patch) | |
tree | 2e527ab9e1b3de23e7dac8011cefc8609ba1d26d /src/qml/jsruntime/qv4globalobject.cpp | |
parent | 314a977217fc158f17fbdda85d7e80edbccc7c7d (diff) |
Fix eval operating on incorrect runtime data
Moved compilationUnit and compiledFunction into the context and set it also
during eval, along with the runtime strings.
Change-Id: I627b3bea0f7c38ad91bc5e8ee85e1484d08ed3f3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4globalobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4globalobject.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp index 49085b659c..99a266bd58 100644 --- a/src/qml/jsruntime/qv4globalobject.cpp +++ b/src/qml/jsruntime/qv4globalobject.cpp @@ -402,12 +402,22 @@ Value EvalFunction::evalCall(Value /*thisObject*/, Value *args, int argc, bool d bool cstrict = ctx->strictMode; ctx->strictMode = strictMode; + CompiledData::CompilationUnit * const oldCompilationUnit = ctx->compilationUnit; + const CompiledData::Function * const oldCompiledFunction = ctx->compiledFunction; + String ** const oldRuntimeStrings = ctx->runtimeStrings; + ctx->compilationUnit = function->compilationUnit; + ctx->compiledFunction = function->compiledFunction; + ctx->runtimeStrings = function->compilationUnit->runtimeStrings; + Value result = Value::undefinedValue(); try { result = function->code(ctx, function->codeData); } catch (Exception &ex) { ctx->strictMode = cstrict; ctx->currentEvalCode = evalCode.next; + ctx->compilationUnit = oldCompilationUnit; + ctx->compiledFunction = oldCompiledFunction; + ctx->runtimeStrings = oldRuntimeStrings; if (strictMode) ex.partiallyUnwindContext(parentContext); throw; @@ -415,6 +425,9 @@ Value EvalFunction::evalCall(Value /*thisObject*/, Value *args, int argc, bool d ctx->strictMode = cstrict; ctx->currentEvalCode = evalCode.next; + ctx->compilationUnit = oldCompilationUnit; + ctx->compiledFunction = oldCompiledFunction; + ctx->runtimeStrings = oldRuntimeStrings; while (engine->current != parentContext) engine->popContext(); |