aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4runtime.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-08-28 12:33:00 +0200
committerLars Knoll <lars.knoll@qt.io>2017-08-28 13:20:29 +0000
commit1e6b41cc180b99dfdbc58d61258871677a643ca6 (patch)
treeb50bebf4fff02dca7e59cafc198b13fdf68eecb4 /src/qml/jsruntime/qv4runtime.cpp
parent4c66a78e2f72a2767a7a4b7587436ecdfb3aebdb (diff)
Cleanup and inline context push/pop related code
Change-Id: I38ee6c3039663e10aee47b2005f8755fc9c50289 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp26
1 files changed, 6 insertions, 20 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 8fe000507f..115129672d 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -1189,27 +1189,18 @@ ReturnedValue Runtime::method_unwindException(ExecutionEngine *engine)
*
* Instead the push/pop pair acts as a non local scope.
*/
-ReturnedValue Runtime::method_pushWithContext(const Value &o, NoThrowEngine *engine)
+ReturnedValue Runtime::method_createWithContext(ExecutionContext *parent, const Value &o)
{
Q_ASSERT(o.isObject());
- ExecutionContext *c = engine->currentContext();
- ReturnedValue oldContext = c->asReturnedValue();
const Object &obj = static_cast<const Object &>(o);
- engine->setCurrentContext(c->newWithContext(obj.d()));
- return oldContext;
+ return parent->newWithContext(obj.d())->asReturnedValue();
}
-ReturnedValue Runtime::method_pushCatchContext(NoThrowEngine *engine, int exceptionVarNameIndex)
+ReturnedValue Runtime::method_createCatchContext(ExecutionContext *parent, int exceptionVarNameIndex)
{
- ExecutionContext *c = engine->currentContext();
- ReturnedValue oldContext = c->asReturnedValue();
- engine->setCurrentContext(c->newCatchContext(engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[exceptionVarNameIndex], engine->catchException(0)));
- return oldContext;
-}
-
-void Runtime::method_popContext(NoThrowEngine *engine, const Value &oldContext)
-{
- engine->setCurrentContext(static_cast<const ExecutionContext &>(oldContext).d());
+ ExecutionEngine *e = parent->engine();
+ return parent->newCatchContext(e->currentStackFrame->v4Function->compilationUnit->runtimeStrings[exceptionVarNameIndex],
+ e->catchException(0))->asReturnedValue();
}
void Runtime::method_declareVar(ExecutionEngine *engine, bool deletable, int nameIndex)
@@ -1287,11 +1278,6 @@ ReturnedValue Runtime::method_loadQmlContext(NoThrowEngine *engine)
return engine->qmlContext()->asReturnedValue();
}
-ReturnedValue Runtime::method_regexpLiteral(ExecutionEngine *engine, int id)
-{
- return static_cast<CompiledData::CompilationUnit*>(engine->currentStackFrame->v4Function->compilationUnit)->runtimeRegularExpressions[id].asReturnedValue();
-}
-
ReturnedValue Runtime::method_loadQmlScopeObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex, bool captureRequired)
{
const QmlContext &c = static_cast<const QmlContext &>(context);