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

Full multiple definitions support #33

Merged
merged 3 commits into from
Feb 18, 2022

Conversation

julienduchesne
Copy link
Member

Some references to vars and self were lost along the way
This works for most use cases now
There's still some refactoring done, both for performance and for cleanliness (lots of repeated code) but it all works now
I will add a video on the README once this is merged

Closes #6

Some references to vars and self were lost along the way
This works for most use cases now
There's still some refactoring done, both for performance and for cleanliness (lots of repeated code) but it all works now
I will add a video on the README once this is merged

Closes #6
@@ -134,18 +149,11 @@ func FindRangesFromIndexList(stack *nodestack.NodeStack, indexList []string, vm
for _, fieldNode := range fieldNodes {
switch fieldNode := fieldNode.(type) {
case *ast.Var:
// If the field is a var, we need to find the value of the var
// To do so, we get the stack where the var is used and search that stack for the var's definition
varFileNode, _, _ := vm.ImportAST("", fieldNode.LocRange.FileName)
Copy link
Member Author

Choose a reason for hiding this comment

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

This code was moved to its own function

Copy link
Contributor

@zzehring zzehring left a comment

Choose a reason for hiding this comment

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

Small nit, but looks good! And yea, we (and specifically this index function) are long overdue for a refactor.

pkg/processing/find_field.go Outdated Show resolved Hide resolved
Co-authored-by: Zack Zehring <zack.zehring@grafana.com>
@julienduchesne julienduchesne merged commit a189bd2 into main Feb 18, 2022
@julienduchesne julienduchesne deleted the julienduchesne/final-support-multiple-defs branch February 18, 2022 20:21
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.

Definition: Return multiple definitions when a field is overridden
2 participants