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 variable expressions in parenthesis #4751

Merged

Conversation

jevanlingen
Copy link
Contributor

What's changed?

Nested parentheses around variable expressions are supported as well for the groovy parser.
Also added the tests for method invocation with nested parentheses (but disabled).

What's your motivation?

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

expression.getName(),
type, null)
);
queue.add(insideParentheses(expression, fmt -> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was just a bug in the parser, the visitVariableExpression should also use the visitVariableExpression so things like:

def timestamp(int hours, int minutes, int seconds) {
  (hours) * 60 * 60 + (minutes * 60) + seconds
}

starts working!

Copy link
Contributor

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

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

Thanks a lot! Great to have this fix pulled in already, and the added tests to know what still needs work.

@timtebeek timtebeek merged commit 7013518 into main Dec 6, 2024
2 checks passed
@timtebeek timtebeek deleted the cleanup-groovy-visitor-plus-nested-parenthesis-tests branch December 6, 2024 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants