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

Missing declaration with hoist_vars if the variable is redeclared #2295

Closed
kevinptt0323 opened this issue Sep 1, 2017 · 1 comment · Fixed by #2297
Closed

Missing declaration with hoist_vars if the variable is redeclared #2295

kevinptt0323 opened this issue Sep 1, 2017 · 1 comment · Fixed by #2297
Labels

Comments

@kevinptt0323
Copy link

Bug report or feature request?

Bug report

ES5 or ES6+ input?

ES5

Uglify version (uglifyjs -V)

uglify-js 3.0.28

JavaScript input

function foo(o) {
    var a = o.a;
    if (a) { return a; }
    else { var a = 1; }
}

The uglifyjs CLI command executed or minify() options used.

uglify in.js -c hoist_vars=true -o out.js

JavaScript output or error produced.

function foo(o){if(a=o.a)return a;a=1}

a is undefined.

@alexlamsl alexlamsl added the bug label Sep 3, 2017
@alexlamsl
Copy link
Collaborator

@kevinptt0323 thanks for the clear & concise report - fix is on the way 👍

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

Successfully merging a pull request may close this issue.

2 participants