Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unused function declarations within functions not removed #1108

Closed
kzc opened this issue Nov 12, 2016 · 0 comments
Closed

Unused function declarations within functions not removed #1108

kzc opened this issue Nov 12, 2016 · 0 comments

Comments

@kzc
Copy link
Contributor

kzc commented Nov 12, 2016

The unused function foo is removed at top level scope, but not at function scope.

$ node bin/rollup -v
rollup version 0.36.3
$ cat wrap.js

function foo() { console.log("FOO"); /* is removed */ }
function baz() { console.log("BAZ"); }
function boo() { /* is removed */ }
baz();

function quux() {
    function foo() { console.log("FOO"); /* should be removed */ }
    function baz() { console.log("BAZ"); }
    function boo() { /* should be removed */ }
    baz();
}
quux();
$ node bin/rollup wrap.js

function baz() { console.log("BAZ"); }
baz();

function quux() {
    function foo() { console.log("FOO"); /* should be removed */ }
    function baz() { console.log("BAZ"); }
    function boo() { /* should be removed */ }
    baz();
}
quux();

Note: this is not a dupe of #977.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants