Skip to content

Commit

Permalink
Do not tree-shake arguments with side-effects (#2924)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Jun 11, 2019
1 parent 355c690 commit 9418822
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ast/scopes/ParameterScope.ts
Expand Up @@ -58,7 +58,8 @@ export default class ParameterScope extends ChildScope {
calledFromTryStatement = true;
}
}
} else if (!argIncluded && arg.shouldBeIncluded()) {
}
if (!argIncluded && arg.shouldBeIncluded()) {
argIncluded = true;
}
if (argIncluded) {
Expand Down
@@ -0,0 +1,3 @@
module.exports = {
description: 'retains arguments that have side-effects'
};
@@ -0,0 +1,10 @@
function sideEffects() {
console.log('print message');
return true;
}

function hola(a, b) {
console.log(a);
}

hola(1, sideEffects());
@@ -0,0 +1,10 @@
function sideEffects() {
console.log('print message');
return true;
}

function hola(a, b) {
console.log(a);
}

hola(1, sideEffects());

0 comments on commit 9418822

Please sign in to comment.