diff options
author | Lars Knoll <[email protected]> | 2013-08-21 15:00:09 +0200 |
---|---|---|
committer | The Qt Project <[email protected]> | 2013-09-02 17:27:36 +0200 |
commit | da2f24d8e5c32fe4ed45dcb89aa357465f85fc1e (patch) | |
tree | 490d63078e83280990fc8c1b416d2d17600ea7d2 /src/qml/jsruntime/qv4context.cpp | |
parent | 29f946cdad013d759aad05cbd22f40d0c152d6f3 (diff) |
move methods to create a new context into the ExecutionContext class
This avoids one indirection when calling the methods and cleans up
the engine a bit.
Change-Id: I426f41e23f6a7262af95b9807b00920530fef642
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4context.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4context.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp index 21a11bbdec..7353d69d32 100644 --- a/src/qml/jsruntime/qv4context.cpp +++ b/src/qml/jsruntime/qv4context.cpp @@ -142,6 +142,32 @@ CallContext *ExecutionContext::newCallContext(FunctionObject *function, const Va return c; } +WithContext *ExecutionContext::newWithContext(Object *with) +{ + WithContext *w = static_cast<WithContext *>(engine->memoryManager->allocContext(sizeof(WithContext))); + engine->current = w; + w->initWithContext(this, with); + return w; +} + +CatchContext *ExecutionContext::newCatchContext(String *exceptionVarName, const Value &exceptionValue) +{ + CatchContext *c = static_cast<CatchContext *>(engine->memoryManager->allocContext(sizeof(CatchContext))); + engine->current = c; + c->initCatchContext(this, exceptionVarName, exceptionValue); + return c; +} + +CallContext *ExecutionContext::newQmlContext(FunctionObject *f, Object *qml) +{ + CallContext *c = static_cast<CallContext *>(engine->memoryManager->allocContext(requiredMemoryForExecutionContect(f, 0))); + + engine->current = c; + c->initQmlContext(this, qml, f); + + return c; +} + void ExecutionContext::createMutableBinding(String *name, bool deletable) |