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

coffeeClasses improved compatibility: private static class fields via =, bound methods via => , constructor shouldn't return #1650

Merged
merged 4 commits into from
Dec 19, 2024

Conversation

edemaine
Copy link
Collaborator

Improved compatibility with CoffeeScript under coffeeClasses mode:

  • Private static classic fields via x = y within a class body, by wrapping body in an IIFE and adding some local variables. Probably only works with autoVar enabled (like various other coffeeCompat features). Fixes Coffeescript runtime bug: private static class fields #457
  • Bound methods via f: => within a class body, by adding to the constructor (after super call if there is one). Also rewrite into method, similar to f: ->. Fixes coffeeCompat thicc arrow function in classes #55.
  • Fix constructor getting an automatically inserted return in most cases. (Recent regression perhaps? This would make coffeeClasses pretty unusable.)

Compilations should match CoffeeScript's compilations.

Copy link
Contributor

@STRd6 STRd6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@edemaine edemaine merged commit a1ed02f into main Dec 19, 2024
4 checks passed
@edemaine edemaine deleted the coffee-classes branch December 19, 2024 03:40
@greghuc
Copy link

greghuc commented Dec 19, 2024

@edemaine many thanks for all this. The generated code even looks nicer than Coffeescript!

This will unblock me on my major CS->Civet migration. I'll aim to make another attempt after Christmas. Fingers crossed on no more big bugs..

Thanks again.

@edemaine
Copy link
Collaborator Author

Great, thanks! Let us know how it goes. (Feel free to join us on Discord too.) Have a good Christmas!

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

Successfully merging this pull request may close these issues.

Coffeescript runtime bug: private static class fields coffeeCompat thicc arrow function in classes
3 participants