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

Doesn't play nice with for...of #587

Closed
ben-eb opened this issue Dec 7, 2014 · 1 comment
Closed

Doesn't play nice with for...of #587

ben-eb opened this issue Dec 7, 2014 · 1 comment

Comments

@ben-eb
Copy link

ben-eb commented Dec 7, 2014

Hello,

I have a bit of a problem using UglifyJS2 with for...of statements; I'm using the new Web MIDI APIs which currently only work with this type of iterator. The relevant code is this:

navigator.requestMIDIAccess().then(function(midiAccess) {
    for (var input of midiAccess.inputs.values()) {
        console.log(input.name);
    }
}, function() { console.log('MIDI unavailable') });

To recreate the problem, just put that in a file and try to parse:

var uglify = require('uglify-js');

var mangled = uglify.minify('problem.js');
console.log('mangled', mangled);

Yields:

/Users/bbriggs/projects/UglifyJS2/lib/parse.js:197
    throw new JS_Parse_Error(message, line, col, pos);
          ^
Error
    at new JS_Parse_Error (/Users/bbriggs/projects/UglifyJS2/lib/parse.js:189:18)
    at js_error (/Users/bbriggs/projects/UglifyJS2/lib/parse.js:197:11)
    at croak (/Users/bbriggs/projects/UglifyJS2/lib/parse.js:657:9)
    at token_error (/Users/bbriggs/projects/UglifyJS2/lib/parse.js:665:9)
    at expect_token (/Users/bbriggs/projects/UglifyJS2/lib/parse.js:678:9)
    at expect (/Users/bbriggs/projects/UglifyJS2/lib/parse.js:681:36)
    at regular_for (/Users/bbriggs/projects/UglifyJS2/lib/parse.js:905:9)
    at for_ (/Users/bbriggs/projects/UglifyJS2/lib/parse.js:901:16)
    at /Users/bbriggs/projects/UglifyJS2/lib/parse.js:783:24
    at /Users/bbriggs/projects/UglifyJS2/lib/parse.js:704:24

API docs: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of
Somewhat related to: browserify/browserify#1008

Thanks. 😃

@ben-eb ben-eb changed the title Doesn't play nice with for...of Doesn't play nice with for...of Dec 7, 2014
@rvanvelzen
Copy link
Collaborator

See #448 for Harmony/ES6 support.

review-squirrel pushed a commit to eclipsesource/tabris-js that referenced this issue Dec 6, 2016
While the client engines support for-of, uglify-js does not [1].
In the meantime, let's add the transpiler plug-in to make use of
this language feature.

[1] mishoo/UglifyJS#587

Change-Id: Ibfc1ac5b66b23efc94e56c2cb10529964ad39549
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

2 participants