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

[apex] Fix node positions for synthetic nodes without RealLoc #3174

Open
adangel opened this issue Mar 27, 2021 · 0 comments
Open

[apex] Fix node positions for synthetic nodes without RealLoc #3174

adangel opened this issue Mar 27, 2021 · 0 comments

Comments

@adangel
Copy link
Member

adangel commented Mar 27, 2021

Follow-up on #3156

So synthetic methods have the coordinates of the last real method of the class. This makes sense, but this may break some assumptions we make on line/column positions. Namely that if a node is-before another in a prefix traversal of the tree, then their positions are also <=. The designer relies on this for instance.

(I think those assumptions are already broken by the apex module anyway, because the designer's node finding methods malfunction)

Maybe we should move those synthetic nodes around when we do the traversal that resolve text coordinates (though since it's already broken we could do that later).

Originally posted by @oowekyala in #3156 (comment)

I'd prefer to do that later. It would be useful to have an explicit test for the condition that the positions of a node is always <= than the position of the next node. Don't we have some test like that in pmd7?

About reordering the nodes: Not sure if we should do that. Currently I think, we use the visit order of the apex jorje parser.

So maybe we should make sure, that the condition is true no matter where the synthetic methods are. That means, we would place them just after the previous (real) sibling and before the next (real) sibling, if there is a next.

If we have a test, we could ensure this conditions in other languages as well.

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

No branches or pull requests

1 participant