Skip to content

Commit

Permalink
Properly include try statements for each pass when deoptimization is …
Browse files Browse the repository at this point in the history
…deactivated (#2914)
  • Loading branch information
lukastaegert committed Jun 10, 2019
1 parent 139c0b5 commit 9abcb7e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ast/nodes/TryStatement.ts
Expand Up @@ -21,7 +21,7 @@ export default class TryStatement extends StatementBase {
}

include(includeChildrenRecursively: IncludeChildren) {
if (!this.directlyIncluded) {
if (!this.directlyIncluded || !this.context.tryCatchDeoptimization) {
this.included = true;
this.directlyIncluded = true;
this.block.include(
Expand Down
@@ -1,8 +1,17 @@
function mutate(foo) {
foo.bar = 1;
}

const mutated = {};

function test(callback) {
try {
callback();
mutate(mutated);
} catch {}
}

test(() => {
});

export { mutated };
Expand Up @@ -2,11 +2,18 @@ function callGlobal() {
Object.create(null);
}

function mutate(foo) {
foo.bar = 1;
}

export const mutated = {};

function test(callback) {
try {
Object.create(null);
callback();
callGlobal();
mutate(mutated);
} catch {}
}

Expand Down

0 comments on commit 9abcb7e

Please sign in to comment.