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

Incorrect transformation of chained methods without indent #1383

Open
ghost opened this issue Apr 12, 2019 · 3 comments
Open

Incorrect transformation of chained methods without indent #1383

ghost opened this issue Apr 12, 2019 · 3 comments

Comments

@ghost
Copy link

ghost commented Apr 12, 2019

(repl)

decaffeinate is producing the wrong JavaScript based on my CoffeeScript input:

a
.b =>
  c
    .d
.e ->
  f

I get this output:

a
.b(() => {
  return c
    .d;
}).e(function() {},
  f
);

Here's what I expect it to be instead:

a
  .b(() => {
    return c
      .d;
}).e(() => f);
@ghost
Copy link
Author

ghost commented Apr 12, 2019

This is due to the .map and .sort chained methods not being indented in from data. Though poor syntax, this does produce valid javascript when ran through a coffeescript compiler: https://jdoodle.com/a/18FG

@eventualbuddha
Copy link
Collaborator

eventualbuddha commented Apr 12, 2019

Looks like the bug is in MainStage since the output of NormalizeStage looks okay.

@ghost
Copy link
Author

ghost commented Apr 12, 2019

Updated the issue with the reduced version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant