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

Replace NavigableMap<LineColumn, List<ASTNode>> to NavigableMap<LineColumn, ASTNode>, because it's impossible to have multiple elements at the very same line and column #4986

Merged
merged 1 commit into from
Feb 5, 2025

Conversation

jevanlingen
Copy link
Contributor

@jevanlingen jevanlingen commented Feb 5, 2025

What's changed?

Little code refactoring; so no new features or bug fixes.

What's your motivation?

When I worked on #4068, I looked at the

NavigableMap<LineColumn, List<ASTNode>> sortedByPosition = new TreeMap<>();` 

line.

After thinking about it, I wondered how for any key there can be multiple nodes attached to it. Since the key is an object of line number and column (basically the x and y of the source code), there is absolutely no way multiple elements can be found, unless I am very much mistaken.

Thus I replaced the list in favour of one ASTNode object.

…neColumn, ASTNode>`, because it's impossible to have multiple elements at the very same line and column
Copy link
Contributor

@Laurens-W Laurens-W left a comment

Choose a reason for hiding this comment

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

LGTM

@jevanlingen jevanlingen merged commit 73c4416 into main Feb 5, 2025
2 checks passed
@jevanlingen jevanlingen deleted the simplify-sorted-by-position-groovy-parser branch February 5, 2025 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants