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

Support "Endless method definition" syntax for Ruby 2.8 (3.0) #49

Closed
wants to merge 1 commit into from

Conversation

koic
Copy link
Member

@koic koic commented Jun 25, 2020

This PR supports "Endless method definition" syntax for Ruby 2.8 (3.0).
Parser gem supports this syntax by whitequark/parser#676.

Ref: https://bugs.ruby-lang.org/issues/16746

@bbatsov
Copy link
Contributor

bbatsov commented Jun 25, 2020

I think we should also add an endless? predicate to the node extension.

@marcandre
Copy link
Contributor

I commented in whitequark/parser#676 that I hope that we can get a simple def (and also in https://bugs.ruby-lang.org/issues/16746 that I hope this is reverted...)
I think we should wait for this feature to be confirmed, or at at least for parser's response?

@koic koic force-pushed the support_endless_method_definition branch from 81d230e to b790142 Compare June 26, 2020 01:28
@koic
Copy link
Member Author

koic commented Jun 26, 2020

Thanks for the discussion at Parser. I thought that it could be introduced to RubyCop AST experimentally, referring to the fact that Ruby Next supports it.
https://github.com/ruby-next/ruby-next

I think we should wait for this feature to be confirmed, or at at least for parser's response?

At least I think we can wait for Parser's response.

https://bugs.ruby-lang.org/issues/16746 that I hope this is reverted...

To be honest, I'm also wondering about adding this syntax to Ruby 😅

Apart from that I added endless? predicate. Thank you.

@koic koic force-pushed the support_endless_method_definition branch from b790142 to 65c20b9 Compare June 26, 2020 04:20
This PR supports "Endless method definition" syntax for Ruby 2.8 (3.0).
Parser gem supports this syntax by whitequark/parser#676.

Ref: https://bugs.ruby-lang.org/issues/16746
@koic koic force-pushed the support_endless_method_definition branch from 65c20b9 to dd89898 Compare June 26, 2020 10:50
@marcandre
Copy link
Contributor

So parser will output def after all. We could add an endless? predicate that would check the presence of loc.end

@koic
Copy link
Member Author

koic commented Jul 6, 2020

Yeah, I will update this PR when Parser 2.7.1.5 (or Parser 2.7.2.0) is released. Thank you for your kindness advice!

@koic
Copy link
Member Author

koic commented Sep 29, 2020

This PR will be closed due to prefer #129. Thank you @marcandre!

@koic koic closed this Sep 29, 2020
@koic koic deleted the support_endless_method_definition branch September 29, 2020 02:52
@marcandre
Copy link
Contributor

This PR will be closed due to prefer #129. Thank you @marcandre!

My pleasure 😄

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.

None yet

3 participants