diff options
| author | Lars Knoll <lars.knoll@qt.io> | 2018-04-06 10:20:08 +0200 |
|---|---|---|
| committer | Lars Knoll <lars.knoll@qt.io> | 2018-05-02 14:17:51 +0000 |
| commit | 922e6f42b4fa9b9fa87246c577c13bb945bd4bc4 (patch) | |
| tree | 182cf430b7340c4f34c0cb350af1c15fd41b6648 /src/qml/jsruntime/qv4runtime.cpp | |
| parent | 20d30b6b3a253eebedc927dbb91685bbec52cfee (diff) | |
Rework catch context handling
Remove the need for a specialized catch context, instead
use a regular block context, that also captures the
catched variable.
This also removes the need to do lookups by name inside
a catch expression.
Change-Id: I8b037add7f423922e2a76b4c0da646ca7e25813a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4runtime.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 95e4017344..40e08ededb 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -1183,11 +1183,6 @@ QV4::ReturnedValue Runtime::method_typeofName(ExecutionEngine *engine, int nameI return method_typeofValue(engine, prop); } -/* The next three methods are a bit tricky. They can't open up a Scope, as that - * would mess up the pushing of the context. - * - * Instead the push/pop pair acts as a non local scope. - */ ReturnedValue Runtime::method_createWithContext(ExecutionContext *parent, const Value &o) { Q_ASSERT(o.isObject()); @@ -1195,11 +1190,11 @@ ReturnedValue Runtime::method_createWithContext(ExecutionContext *parent, const return parent->newWithContext(obj.d())->asReturnedValue(); } -ReturnedValue Runtime::method_createCatchContext(ExecutionContext *parent, int exceptionVarNameIndex) +ReturnedValue Runtime::method_createCatchContext(ExecutionContext *parent, int blockIndex, int exceptionVarNameIndex) { ExecutionEngine *e = parent->engine(); - return parent->newCatchContext(e->currentStackFrame->v4Function->compilationUnit->runtimeStrings[exceptionVarNameIndex], - e->catchException(nullptr))->asReturnedValue(); + return parent->newCatchContext(e->currentStackFrame, blockIndex, + e->currentStackFrame->v4Function->compilationUnit->runtimeStrings[exceptionVarNameIndex])->asReturnedValue(); } ReturnedValue Runtime::method_createBlockContext(ExecutionContext *parent, int index) |
