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

Named expression-style classes should assign that name to their scope #867

Closed
alangpierce opened this issue Feb 25, 2017 · 0 comments
Closed
Assignees

Comments

@alangpierce
Copy link
Member

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

A = class B
console.log(B)

(repl)

I get this output:

const A = class B {};
console.log(B);

Here's what I expect it to be instead:

let B;
const A = B = class B {};
console.log(B);

This is causing the atom tests to fail after decaffeinate.

@alangpierce alangpierce self-assigned this Feb 25, 2017
alangpierce added a commit to alangpierce/decaffeinate that referenced this issue Feb 26, 2017
Fixes decaffeinate#867

Unlike in JavaScript, CoffeeScript named classes assign to their outer scope, so
we need an explicit assignment unless we know the class will be a JS class
declaration statement.
alangpierce added a commit that referenced this issue Feb 26, 2017
Fixes #867

Unlike in JavaScript, CoffeeScript named classes assign to their outer scope, so
we need an explicit assignment unless we know the class will be a JS class
declaration statement.
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