ignore var redeclare #143

Open
graingert opened this Issue Jul 4, 2016 · 1 comment

Projects

None yet

2 participants

@graingert

redeclares should be ignored:

function foo (){
  var a = 3;
  for (i in x) {
    var a = 7;
  }
}

is the same as:

function foo (){
  var a = 3;
  for (i in x) {
    a = 7;
  }
}

so both should become:

function foo (){
  let a = 3;
  for (i in x) {
    a = 7;
  }
}
@nene
Collaborator
nene commented Jul 7, 2016

Yeah. Actually the current implementation tries to ignore the redeclared variables, but the result is not pretty. Probably better to convert the redeclares to simple assignments. This should actually simplify the transformation code.

@nene nene added the enhancement label Jul 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment