Add a way to run a callback on file load - #16
Merged
Conversation
TedDriggs
reviewed
Jul 16, 2020
| /// recursively inlined. | ||
| pub fn parse_and_inline_modules(&self, src_file: &Path) -> Result<InliningResult, Error> { | ||
| self.parse_internal(src_file, FsResolver::default()) | ||
| // Rust seems to not be able to resolve callback lifetimes properly with an inline |
Owner
There was a problem hiding this comment.
I ran into this problem before; I think you have to pass it as &impl or something and then it works.
Contributor
Author
There was a problem hiding this comment.
Ahh, I couldn't figure out what you meant but it looked like simply annotating one of the arguments with the type worked fine.
This is useful when integrating syn-inline-mod with other systems, as it allows for file contents to be recorded for e.g. later error reporting. This required some refactoring as we had to pass a `&mut R` down through the visitor. Included is a test which ensures that syn-inline-mod works on the crate itself.
TedDriggs
approved these changes
Jul 17, 2020
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
(This is based on #14.)
This is useful when integrating syn-inline-mod with other systems, as it allows
for file contents to be recorded for e.g. later error reporting.
This required some refactoring as we had to pass a
&mut Rdown through thevisitor.
Included is a test which ensures that syn-inline-mod works on the crate itself.