aboutsummaryrefslogtreecommitdiffstats
path: root/qv4codegen.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2012-12-12 18:35:42 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-12-12 10:05:52 +0100
commitd597083c012274d9a591e0805e2d892393cc9e89 (patch)
tree0490726341d490b3c516c32934525769173ef997 /qv4codegen.cpp
parent3c397f6b2afabe7323141dd68cfb38d66761fc3f (diff)
Use a new and empty cleanup list for try statements when entering a function
The cleanup list is local to a function definition. Otherwise inner functions would create cleanup code for try statements in outer functions leading to crashes. Change-Id: I5d35893b0ea6b0692cda44d5b34b0bb3dfc93fdd Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'qv4codegen.cpp')
-rw-r--r--qv4codegen.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/qv4codegen.cpp b/qv4codegen.cpp
index a16d8c4d9e..a6c1f7f4ce 100644
--- a/qv4codegen.cpp
+++ b/qv4codegen.cpp
@@ -1613,6 +1613,8 @@ IR::Function *Codegen::defineFunction(const QString &name, AST::Node *ast,
{
qSwap(_mode, mode); // enter function code.
+ TryCleanup *tryCleanup = 0;
+
enterEnvironment(ast);
IR::Function *function = _module->newFunction(name);
if (_debugger)
@@ -1665,6 +1667,7 @@ IR::Function *Codegen::defineFunction(const QString &name, AST::Node *ast,
qSwap(_exitBlock, exitBlock);
qSwap(_throwBlock, throwBlock);
qSwap(_returnAddress, returnAddress);
+ qSwap(_tryCleanup, tryCleanup);
for (FormalParameterList *it = formals; it; it = it->next) {
_function->RECEIVE(it->name.toString());
@@ -1694,6 +1697,7 @@ IR::Function *Codegen::defineFunction(const QString &name, AST::Node *ast,
qSwap(_exitBlock, exitBlock);
qSwap(_throwBlock, throwBlock);
qSwap(_returnAddress, returnAddress);
+ qSwap(_tryCleanup, tryCleanup);
leaveEnvironment();