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

Dead code elimination leaves break behind in while loop #419

Closed
bbtgp opened this issue Feb 10, 2017 · 1 comment · Fixed by #433
Closed

Dead code elimination leaves break behind in while loop #419

bbtgp opened this issue Feb 10, 2017 · 1 comment · Fixed by #433
Labels
bug Confirmed bug has PR Has an open PR that fixes this issue

Comments

@bbtgp
Copy link

bbtgp commented Feb 10, 2017

For repl:

let test = class  {
  
  method(arg) {
    do {
      if(arg.condition) {
        break; // Problem
     }
    } while(false);

  }
  
}

outputs:

let test = class{
  method(a) {
    if(a.condition)
        break // Illegal 
    }
 }

packages/babel-plugin-minify-dead-code-elimination/src/index.js:591

@boopathi boopathi added the bug Confirmed bug label Feb 10, 2017
@boopathi boopathi added the has PR Has an open PR that fixes this issue label Feb 20, 2017
boopathi added a commit that referenced this issue Feb 27, 2017
* Deopt do..while stmts with break - (fix #419)

* Add continue statement
@xingmarc
Copy link

Hi, I still got the Illegal break statement error on Babel REPL:
input:

var test = {
  metod: function(arg) {
    do {
      if(arg.condition) {
        break;
     }
    } while(false);
  }
}

output:

"use strict";var test={metod:function metod(a){if(a.condition)break}};

This change is not released yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug has PR Has an open PR that fixes this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants