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
feat: Improve il2cpp line mapping parser #595
Conversation
The parser will now look for the next non-comment line when it encounters a source_info comment and take that as the cpp_line, instead of just taking the source_info comment line itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should be a bit more conservative, as in:
- emit a mapping when you have two consecutive markers without any code line in between
- emit a trailing mapping for the second testcase, when you don’t have any non-comment line at the end of a file
I’m not quite sure we should care about that, since realistically speaking those cases won’t happen in real life code, and since this is very much best effort, we might as well ignore those.
It might be good to have a larger unit test though, with a couple more mappings in it.
Some((cs_file, cs_line)) => { | ||
let next_non_comment_line_nr = self.lines.find_map(|(nr, src_line)| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is find_map
defined as being "short circuiting"? It would be bad if it exhausted the whole iterator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it stops as soon as it finds the first Some
return value. It's equivalent to filter_map(…).next()
.
Codecov Report
@@ Coverage Diff @@
## master #595 +/- ##
==========================================
+ Coverage 67.74% 67.90% +0.15%
==========================================
Files 102 102
Lines 19043 19122 +79
==========================================
+ Hits 12900 12984 +84
+ Misses 6143 6138 -5 |
The parser will now look for the next non-comment line when it encounters a source_info comment and take that as the cpp_line, instead of just taking the source_info comment line itself.