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

report of unreachable code #1234

Closed
GarryFlemings opened this issue Sep 14, 2016 · 2 comments
Closed

report of unreachable code #1234

GarryFlemings opened this issue Sep 14, 2016 · 2 comments

Comments

@GarryFlemings
Copy link

Windows 10 on a Toshiba laptop, AMD A6
Node v6.2.0
bluebird v3.4.6
webpack v1.13.2
uglify-js v2.6.4

unknown whether this affects any other version of bluebird

issue: report of unreachable code, line 5421

background: I used webpack to create a deployment bundle. It called UglifyJs, which reported the above as an Error. In my copy of the bluebird code, I see, starting with line 5414:

function toFastProperties(obj) {
/jshint -W027,-W055,-W031/
function FakeConstructor() {}
FakeConstructor.prototype = obj;
var l = 8;
while (l--) new FakeConstructor();
return obj;
eval(obj);
}

I reversed the last two code lines, making:

function toFastProperties(obj) {
/jshint -W027,-W055,-W031/
function FakeConstructor() {}
FakeConstructor.prototype = obj;
var l = 8;
while (l--) new FakeConstructor();
eval(obj);
return obj;
}

Right or wrong for you, it made the error go away for me.

If I can provide more info that'll help, please let me know.

@bergus
Copy link
Contributor

bergus commented Sep 14, 2016

The code is unreachable on purpose. Have a look at https://stackoverflow.com/q/24987896/1048572?how-does-bluebirds-util-tofastproperties-function-make-an-objects-properties
Are you sure you have to run Uglify on Bluebird, it comes with an already minified version?

@ORESoftware
Copy link

JavaScript warning: https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.5.0/bluebird.js, line 5438: unreachable code after return statement
JavaScript warning: https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.5.0/bluebird.js, line 5438: unreachable code after return statement

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

No branches or pull requests

4 participants