rainforestapp / decaf

Coffeescript to ES.next transpiler. Now maintained over at
https://github.com/juliankrispel/decaf
MIT License
106 stars 10 forks source link

Variable assignments in switch case #136

Closed juliankrispel closed 8 years ago

juliankrispel commented 8 years ago

this

switch word
  when 'hello'
    a = 'boom'
  else
    a = 'bim'

compiles to this:

switch (word) {
case "hello":
  var a = "boom";
  break;
default:
  a = "bim";
}

It should declare the variable in the scope of the switch statement, not in the case itself.