This repository was archived by the owner on Jan 16, 2024. It is now read-only.
Repository navigation
Support import aliases - #82
Merged
Merged
Conversation
TomChv
reviewed
Jul 30, 2022
Comment on lines
+216
to
+218
| if i, found := p.imports[pkgName]; found { | ||
| return i, nil | ||
| } |
Member
There was a problem hiding this comment.
i is already set to the current instance no? Are Those 3 lines useful?
Contributor
Author
There was a problem hiding this comment.
Absolutely not :)
Updated
It doesn't seem possible to get package aliases from cue's build instances. They only seem to be used internally in the adt and not exported in the public API. Therefore the patch relies on the ast to record package aliases by loaded file. When the selector of a definition isn't found we make some extra calls to see if it's a package alias in the current file and find the associated instance. Closes dagger#79
Member
|
I tried it locally, it works well! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It doesn't seem possible to get package aliases from cue's build
instances. They only seem to be used internally in the adt and not
exported in the public API.
Therefore the patch relies on the ast to record package aliases by
loaded file. When the selector of a definition isn't found we make some
extra calls to see if it's a package alias in the current file and find
the associated instance.
Closes #79