Skip to content

cannot avoid returning 'then' part of switch if it's the last statement in a function #250

Closed
@timaschew

Description

@timaschew

from #168

Still doesn't completely solve the problem when a function ends with a switch statement.

foobar = function(callback) {
  var x;
  x = "foo";
  switch (a) {
    case 1:
       "1"; break;
    case 2:
       "2"; break;
    default:
       "default";break;
  }
};

result:

foobar = (callback) ->
  x = undefined
  x = "foo"
  switch a
    when 1
      "1"
    when 2
      "2"
    else
      "default"

expected:

foobar = (callback) ->
  x = undefined
  x = "foo"
  switch a
    when 1
      "1"
    when 2
      "2"
    else
      "default"
  return

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions